- BindRestore _bind(this);
- glTexSubImage3D(target, level, x, y, z, wd, ht, dp, fmt, type, data);
-}
-
-void Texture3D::load_image(const string &fn, int dp)
-{
- Graphics::Image img;
- img.load_file(fn);
-
- unsigned w = img.get_width();
- unsigned h = img.get_height();
- unsigned d = 1;
-
- if(dp==-1)
- {
- if(h%w)
- throw incompatible_data("Texture3D::load_image");
- d = h/w;
- h = w;
- }
- else if(dp==-2)
- {
- for(d=h; d*d>h; d>>=2) ;
- for(; d*d<h; ++d) ;
- if(d*d!=h)
- throw incompatible_data("Texture3D::load_image");
- h = d;
- }
- else if(dp>0)
- {
- d = dp;
- if(h%d)
- throw incompatible_data("Texture3D::load_image");
- h /= d;
- }
+ comp = get_upload_components(comp);
+ if(ARB_direct_state_access)
+ glTextureSubImage3D(id, level, x, y, z, wd, ht, dp, comp, type, data);