X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=8306324153747078300a9b593d392d78f91cd5a6;hp=19c3bf074b9a3557adf7668c4752f22bda3bcb8c;hb=81e0e39fefd8f50ae2367fe821d58af6273bcea2;hpb=cdf928f03f4d8383b8fa978abc4c255a850ec061 diff --git a/source/texturecube.cpp b/source/texturecube.cpp index 19c3bf07..83063241 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -51,7 +51,7 @@ TextureCube::TextureCube(): static Require _req(ARB_texture_cube_map); } -void TextureCube::storage(PixelFormat fmt, unsigned sz) +void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv) { if(size>0) throw invalid_operation("TextureCube::storage"); @@ -60,19 +60,25 @@ void TextureCube::storage(PixelFormat fmt, unsigned sz) set_internal_format(fmt); size = sz; + levels = get_n_levels(); + if(lv>0) + levels = min(levels, lv); } void TextureCube::allocate(unsigned level) { + if(size==0) + throw invalid_operation("TextureCube::allocate"); + if(level>=levels) + throw invalid_argument("TextureCube::allocate"); if(allocated&(1<