]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texturecube.cpp
Make explicit mipmap generation public
[libs/gl.git] / source / texturecube.cpp
index ee8c71c5b0399e88f7c15b375878cf64623a4472..cd18c10d6909a2c459c4b2409789069900a67b88 100644 (file)
@@ -106,10 +106,10 @@ void TextureCube::image(TextureCubeFace face, unsigned level, PixelFormat fmt, D
 
        // XXX Allocation should be tracked per-face, but we'll run out of bits
        allocated |= 1<<level;
-       if(gen_mipmap && level==0)
+       if(auto_gen_mipmap==1 && level==0)
        {
                // TODO Only do this once all faces are created
-               auto_generate_mipmap();
+               generate_mipmap();
                allocated |= (1<<get_n_levels())-1;
        }
 }
@@ -124,8 +124,8 @@ void TextureCube::sub_image(TextureCubeFace face, unsigned level, int x, int y,
 
        glTexSubImage2D(face, level, x, y, wd, ht, get_upload_format(fmt), type, data);
 
-       if(gen_mipmap && level==0)
-               auto_generate_mipmap();
+       if(auto_gen_mipmap==1 && level==0)
+               generate_mipmap();
 }
 
 void TextureCube::image(TextureCubeFace face, const Graphics::Image &img, bool srgb)
@@ -161,7 +161,7 @@ void TextureCube::image(const Graphics::Image &img, bool srgb)
        PixelFormat fmt = pixelformat_from_graphics(img.get_format());
        if(size==0)
        {
-               unsigned l = (is_mipmapped(min_filter) ? 0 : 1);
+               unsigned l = (is_mipmapped(min_filter) ? mipmap_levels ? mipmap_levels : 0 : 1);
                storage(storage_pixelformat_from_graphics(img.get_format(), srgb), w, l);
        }
        else if(w!=size || h!=size)
@@ -285,8 +285,6 @@ void TextureCube::Loader::raw_data(TextureCubeFace face, const string &data)
 
 void TextureCube::Loader::storage(PixelFormat fmt, unsigned s)
 {
-       if(srgb)
-               fmt = get_srgb_pixelformat(fmt);
        obj.storage(fmt, s);
 }