]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/texture2d.cpp
Unmanage texture if loading data directly
[libs/gl.git] / source / core / texture2d.cpp
index d2addda70fc4d6e35de11e2df472bf98b89d9940..6e7d97202f341cc12e2a76d9e94b92f840c3ff94 100644 (file)
@@ -230,6 +230,12 @@ void Texture2D::Loader::init()
 
 void Texture2D::Loader::raw_data(const string &data)
 {
+       if(obj.manager)
+       {
+               obj.set_manager(0);
+               if(!obj.id)
+                       obj.generate_id();
+       }
        obj.image(0, data.data());
 }
 
@@ -290,12 +296,7 @@ bool Texture2D::AsyncLoader::process()
                }
 
                if(!texture.id)
-               {
-                       if(ARB_direct_state_access)
-                               glCreateTextures(texture.target, 1, &texture.id);
-                       else
-                               glGenTextures(1, &texture.id);
-               }
+                       texture.generate_id();
                texture.image(image, 0, true);
        }