]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture2d.cpp
Provide a getter for the number of active animations
[libs/gl.git] / source / texture2d.cpp
index e237e504176ace2bfd56ddf74597907aee397abb..7cad81d92a5e44e2717bbaf88f1c35d166fa8dc3 100644 (file)
@@ -74,6 +74,7 @@ void Texture2D::image(unsigned level, PixelFormat fmt, DataType type, const void
        allocated |= 1<<level;
        if(gen_mipmap && level==0)
        {
+               auto_generate_mipmap();
                for(; (w || h); w>>=1, h>>=1, ++level) ;
                allocated |= (1<<level)-1;
        }
@@ -207,10 +208,7 @@ Texture2D::AsyncLoader::AsyncLoader(Texture2D &t, IO::Seekable &i):
        pixel_buffer(PIXEL_UNPACK_BUFFER),
        mapped_address(0),
        phase(0)
-{
-       if(!texture.id)
-               glGenTextures(1, &texture.id);
-}
+{ }
 
 bool Texture2D::AsyncLoader::needs_sync() const
 {
@@ -245,6 +243,8 @@ bool Texture2D::AsyncLoader::process()
                        return false;
                }
 
+               if(!texture.id)
+                       glGenTextures(1, &texture.id);
                texture.image(image, false, true);
        }