- bool direct = (ARB_direct_state_access && (ARB_texture_storage || (allocated&(1<<level))));
- if(!direct)
- {
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(target, id);
- }
-
- allocate_(level);
-
- GLenum comp = get_gl_components(get_components(storage_fmt));
- GLenum type = get_gl_type(get_component_type(storage_fmt));
- if(ARB_direct_state_access)
- glTextureSubImage3D(id, level, x, y, z, wd, ht, dp, comp, type, data);
- else
- glTexSubImage3D(target, level, x, y, z, wd, ht, dp, comp, type, data);
-
- if(auto_gen_mipmap && level==0)
- generate_mipmap_();
-
- if(!direct)
- glBindTexture(target, 0);
-}
-
-void Texture3D::sub_image(unsigned level, int x, int y, int z, unsigned wd, unsigned ht, unsigned dp, PixelComponents comp, DataType type, const void *data)
-{
- if(comp!=get_components(format) || type!=get_component_type(format))
- throw incompatible_data("Texture3D::sub_image");
- sub_image(level, x, y, z, wd, ht, dp, data);