Texture3D::Texture3D():
Texture(GL_TEXTURE_3D),
+ ifmt(RGB),
width(0),
height(0),
depth(0),
if(allocated&(1<<level))
return;
- image(level, get_base_pixelformat(ifmt), UNSIGNED_BYTE, 0);
+ PixelFormat base_fmt = get_base_pixelformat(ifmt);
+ image(level, base_fmt, get_alloc_type(base_fmt), 0);
}
void Texture3D::image(unsigned level, PixelFormat fmt, DataType type, const void *data)
allocated |= 1<<level;
if(gen_mipmap && level==0)
{
+ auto_generate_mipmap();
for(; (w || h || d); w>>=1, h>>=1, d>>=1, ++level) ;
allocated |= (1<<level)-1;
}
d = 1;
}
+UInt64 Texture3D::get_data_size() const
+{
+ return id ? width*height*depth*get_pixel_size(ifmt) : 0;
+}
+
} // namespace GL
} // namespace Msp