-void Texture3D::allocate(unsigned level)
-{
- if(width==0 || height==0 || depth==0)
- throw invalid_operation("Texture3D::allocate");
- if(level>=levels)
- throw invalid_argument("Texture3D::allocate");
- if(allocated&(1<<level))
- return;
-
- if(ARB_texture_storage)
- {
- GLenum fmt = get_gl_pixelformat(storage_fmt);
- if(ARB_direct_state_access)
- glTextureStorage3D(id, levels, fmt, width, height, depth);
- else
- {
- bind_scratch();
- glTexStorage3D(target, levels, fmt, width, height, depth);
- }
- apply_swizzle();
- allocated |= (1<<levels)-1;
- }
- else
- image(level, 0);