X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexturecube.cpp;h=460c109e91879b986129b4ea01ec36a6369c00e2;hb=cf1676a405c2a81413fd565bc83331b7a8778eb5;hp=5c7f61029c3c736eb3245e99b559b29c7e79f2aa;hpb=a92362ad19b65f66b98e0dc4d034da5e4eb5cf36;p=libs%2Fgl.git diff --git a/source/core/texturecube.cpp b/source/core/texturecube.cpp index 5c7f6102..460c109e 100644 --- a/source/core/texturecube.cpp +++ b/source/core/texturecube.cpp @@ -5,7 +5,6 @@ #include #include #include -#include "bindable.h" #include "error.h" #include "texturecube.h" @@ -46,12 +45,18 @@ unsigned TextureCube::orientations[12] = TextureCube::TextureCube(): Texture(GL_TEXTURE_CUBE_MAP), - size(0), - allocated(0) + size(0) { static Require _req(ARB_texture_cube_map); if(ARB_seamless_cube_map) - glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); + { + static bool seamless_init = false; + if(!seamless_init) + { + glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); + seamless_init = true; + } + } } void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv) @@ -70,109 +75,39 @@ void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv) 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&(64<=levels) - throw out_of_range("TextureCube::image"); - - if(ARB_texture_storage) - { - unsigned lsz = get_level_size(level); - return sub_image(face, level, 0, 0, lsz, lsz, data); - } - - glActiveTexture(GL_TEXTURE0); - glBindTexture(target, id); - - image_(face, level, data); - - if(auto_gen_mipmap && level==0 && (allocated&63)==63) - { - generate_mipmap_(); - allocated |= (64<=levels) throw out_of_range("TextureCube::sub_image"); - bool direct = (ARB_direct_state_access && (ARB_texture_storage || (allocated&(1<