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