- if(width==0 || height==0 || depth==0)
- throw invalid_operation("Texture3D::image");
-
- unsigned w = width;
- unsigned h = height;
- unsigned d = depth;
- get_level_size(level, w, h, d);
-
- if(ARB_texture_storage)
- return sub_image(level, 0, 0, 0, w, h, d, data);
-
- BindRestore _bind(this);
-
- if(!allocated)
- {
- glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, levels-1);
- apply_swizzle();
- }
-
- PixelComponents comp = get_components(storage_fmt);
- GLenum type = get_gl_type(get_component_type(storage_fmt));
- glTexImage3D(target, level, storage_fmt, width, height, depth, 0, comp, type, data);
-
- allocated |= 1<<level;
- if(auto_gen_mipmap && level==0)
- {
- generate_mipmap();
- allocated |= (1<<levels)-1;
- }
-}
-
-void Texture3D::image(unsigned level, PixelComponents comp, DataType type, const void *data)
-{
- if(comp!=get_components(format) || type!=get_component_type(format))
- throw incompatible_data("Texture3D::image");
- image(level, data);
+ LinAl::Vector<unsigned, 3> size = get_level_size(level);
+ return sub_image(level, 0, 0, 0, size.x, size.y, size.z, data);