if(ARB_direct_state_access)
glTextureStorage2D(id, levels, ifmt, width, height);
else
if(ARB_direct_state_access)
glTextureStorage2D(id, levels, ifmt, width, height);
else
glTexStorage2D(target, levels, ifmt, width, height);
glTexStorage2D(target, levels, ifmt, width, height);
return sub_image(level, 0, 0, w, h, fmt, type, data);
BindRestore _bind(this);
return sub_image(level, 0, 0, w, h, fmt, type, data);
BindRestore _bind(this);
glTexImage2D(target, level, ifmt, w, h, 0, get_upload_format(fmt), type, data);
allocated |= 1<<level;
if(auto_gen_mipmap && level==0)
{
generate_mipmap();
glTexImage2D(target, level, ifmt, w, h, 0, get_upload_format(fmt), type, data);
allocated |= 1<<level;
if(auto_gen_mipmap && level==0)
{
generate_mipmap();
-void Texture2D::image(const Graphics::Image &img, bool srgb, bool from_buffer)
+void Texture2D::image(const Graphics::Image &img, unsigned lv, bool srgb, bool from_buffer)
{
unsigned w = img.get_width();
unsigned h = img.get_height();
PixelFormat fmt = pixelformat_from_graphics(img.get_format());
if(width==0)
{
unsigned w = img.get_width();
unsigned h = img.get_height();
PixelFormat fmt = pixelformat_from_graphics(img.get_format());
if(width==0)
- {
- unsigned l = (is_mipmapped(min_filter) ? mipmap_levels ? mipmap_levels : 0 : 1);
- storage(storage_pixelformat_from_graphics(img.get_format(), srgb), w, h, l);
- }
- else if(w!=width || h!=height)
+ storage(storage_pixelformat_from_graphics(img.get_format(), srgb), w, h, lv);
+ else if(w!=width || h!=height || (lv && lv!=levels))
{
add("raw_data", &Loader::raw_data);
add("storage", &Loader::storage);
{
add("raw_data", &Loader::raw_data);
add("storage", &Loader::storage);
+void Texture2D::Loader::storage_levels(PixelFormat fmt, unsigned w, unsigned h, unsigned l)
+{
+ obj.storage(fmt, w, h, l);
+}
+