- GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
- if(ARB_texture_storage)
- {
- if(ARB_direct_state_access)
- glTextureStorage3D(id, levels, gl_fmt, width, height, depth);
- else
- {
- bind_scratch();
- glTexStorage3D(target, levels, gl_fmt, width, height, depth);
- }
- }
- else
- {
- bind_scratch();
- GLenum comp = get_gl_components(get_components(storage_fmt));
- GLenum type = get_gl_type(get_component_type(storage_fmt));
- for(unsigned i=0; i<levels; ++i)
- {
- LinAl::Vector<unsigned, 3> lv_size = get_level_size(i);
- glTexImage3D(target, i, gl_fmt, lv_size.x, lv_size.y, lv_size.z, 0, comp, type, 0);
- }
- glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels-1);
- }
-
- apply_swizzle();