- BindRestore _bind(this);
- glTexSubImage2D(target, level, x, y, wd, ht, fmt, type, data);
+ fmt = get_upload_format(fmt);
+ if(ARB_direct_state_access)
+ glTextureSubImage2D(id, level, x, y, wd, ht, fmt, type, data);
+ else
+ glTexSubImage2D(target, level, x, y, wd, ht, fmt, type, data);
+
+ if(gen_mipmap && level==0)
+ auto_generate_mipmap();