X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexturecube.cpp;h=03e65167d73fee7a1d89ba9ea3cea7ef2c68d81d;hp=833ef28f0ebd78add08ccfae4c8555df87dff288;hb=8e14c298d9eaa47b81e27d5c25174bda958b445f;hpb=b2c8b2238877f76cdea184cca70336b15ddb78d9 diff --git a/source/texturecube.cpp b/source/texturecube.cpp index 833ef28f..03e65167 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -45,39 +45,40 @@ unsigned TextureCube::orientations[12] = TextureCube::TextureCube(): Texture(GL_TEXTURE_CUBE_MAP), - ifmt(RGB), size(0), allocated(0) { 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"); if(sz==0) throw invalid_argument("TextureCube::storage"); - if(MSP_sized_internal_formats) - fmt = get_sized_pixelformat(fmt); - require_pixelformat(fmt); - - ifmt = fmt; + 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<