X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=03e65167d73fee7a1d89ba9ea3cea7ef2c68d81d;hp=19c3bf074b9a3557adf7668c4752f22bda3bcb8c;hb=a2e5fc44fc4eae17c98a569af1c6bd0baf1f7684;hpb=cdf928f03f4d8383b8fa978abc4c255a850ec061 diff --git a/source/texturecube.cpp b/source/texturecube.cpp index 19c3bf07..03e65167 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<