X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=03e65167d73fee7a1d89ba9ea3cea7ef2c68d81d;hp=db679cf9e1259cb4feb0e087c0f3e066c40921c3;hb=8e14c298d9eaa47b81e27d5c25174bda958b445f;hpb=1955e583d7eeeb0a2ff054d90c3694f575d9a08d diff --git a/source/texturecube.cpp b/source/texturecube.cpp index db679cf9..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<