X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fcore%2Ftexture3d.cpp;h=285abeb957665b3cad558f2caf62d2d29b04166e;hb=3a1b9cbe2441ae670a97541dc8ccb0a2860c8302;hp=bdb87882e878333c23e88373bc85b57d277c7e74;hpb=a0538cdd026622f7f0f3e2ac1f9c2bd54c4a6014;p=libs%2Fgl.git diff --git a/source/core/texture3d.cpp b/source/core/texture3d.cpp index bdb87882..285abeb9 100644 --- a/source/core/texture3d.cpp +++ b/source/core/texture3d.cpp @@ -57,22 +57,6 @@ void Texture3D::allocate(unsigned level) throw invalid_operation("Texture3D::allocate"); if(level>=levels) throw invalid_argument("Texture3D::allocate"); - - bool direct = ARB_texture_storage && ARB_direct_state_access; - if(!direct) - { - glActiveTexture(GL_TEXTURE0); - glBindTexture(target, id); - } - - allocate_(level); - - if(!direct) - glBindTexture(target, 0); -} - -void Texture3D::allocate_(unsigned level) -{ if(allocated&(1<=levels) throw out_of_range("Texture3D::image"); + LinAl::Vector size = get_level_size(level); + if(ARB_texture_storage) - { - LinAl::Vector size = get_level_size(level); return sub_image(level, 0, 0, 0, size.x, size.y, size.z, data); - } - - glActiveTexture(GL_TEXTURE0); - glBindTexture(target, id); - - image_(level, data); - if(auto_gen_mipmap && level==0) - { - generate_mipmap_(); - allocated |= (1< size = get_level_size(level); GLenum fmt = get_gl_pixelformat(storage_fmt); GLenum comp = get_gl_components(get_components(storage_fmt)); GLenum type = get_gl_type(get_component_type(storage_fmt)); @@ -148,27 +119,17 @@ void Texture3D::sub_image(unsigned level, int x, int y, int z, unsigned wd, unsi if(level>=levels) throw out_of_range("Texture3D::sub_image"); - bool direct = (ARB_direct_state_access && (ARB_texture_storage || (allocated&(1< Texture3D::get_level_size(unsigned level) const return LinAl::Vector(w, h, d); } -UInt64 Texture3D::get_data_size() const +uint64_t Texture3D::get_data_size() const { return id ? width*height*depth*get_pixel_size(storage_fmt) : 0; }