X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=ee8c71c5b0399e88f7c15b375878cf64623a4472;hp=b9a8f5dd02b8cacb73f63df7bce028a5920035cd;hb=03d3984ecd2c4e7c38b6a62b4b7a81bab69f8d40;hpb=3c46227c280bc4cd8a4487c648f2f080d5b4f7ea diff --git a/source/texturecube.cpp b/source/texturecube.cpp index b9a8f5dd..ee8c71c5 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,21 +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<