X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexturecube.cpp;h=5c7f61029c3c736eb3245e99b559b29c7e79f2aa;hb=a92362ad19b65f66b98e0dc4d034da5e4eb5cf36;hp=01820fa8766be6afa5235419c5da9d63062a6388;hpb=9e9216405fb999a1a6c4f8865264f4e7e335e7aa;p=libs%2Fgl.git diff --git a/source/core/texturecube.cpp b/source/core/texturecube.cpp index 01820fa8..5c7f6102 100644 --- a/source/core/texturecube.cpp +++ b/source/core/texturecube.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -6,7 +7,6 @@ #include #include "bindable.h" #include "error.h" -#include "pixelstore.h" #include "texturecube.h" using namespace std; @@ -81,17 +81,34 @@ void TextureCube::allocate(unsigned level) if(allocated&(64<=levels) throw out_of_range("TextureCube::image"); if(ARB_texture_storage) - return sub_image(face, level, 0, 0, s, s, data); + { + unsigned lsz = get_level_size(level); + return sub_image(face, level, 0, 0, lsz, lsz, data); + } - BindRestore _bind(this); + 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"); - BindRestore _bind(this); - allocate(level); + bool direct = (ARB_direct_state_access && (ARB_texture_storage || (allocated&(1<(img.get_pixels()); unsigned face_size = img.get_stride()*size; for(unsigned i=0; i<6; ++i)