]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture2d.cpp
Better handling of unloaded textures
[libs/gl.git] / source / texture2d.cpp
index e237e504176ace2bfd56ddf74597907aee397abb..2ea713eb3a539c9705e13f90b2775ff9b643fdfd 100644 (file)
@@ -207,10 +207,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 +242,8 @@ bool Texture2D::AsyncLoader::process()
                        return false;
                }
 
+               if(!texture.id)
+                       glGenTextures(1, &texture.id);
                texture.image(image, false, true);
        }