- image(0, ifmt, GL_UNSIGNED_BYTE, 0);
+ unsigned w = width;
+ unsigned h = height;
+ unsigned d = depth;
+ get_level_size(level, w, h, d);
+
+ BindRestore _bind(this);
+ glTexImage3D(target, level, ifmt, width, height, depth, 0, fmt, type, 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;
+ }