]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture2d.cpp
Use glCreateTextures also for async loading
[libs/gl.git] / source / texture2d.cpp
index daede1836332ca9c2b72a41edf5634a99a09abb1..08383526728bb7a239b8551c910c75c6a2ff2f03 100644 (file)
@@ -252,8 +252,8 @@ bool Texture2D::AsyncLoader::process()
        }
        else if(phase==1)
        {
-               pixel_buffer.data(n_bytes, 0);
-               mapped_address = reinterpret_cast<char *>(pixel_buffer.map(WRITE_ONLY));
+               pixel_buffer.storage(n_bytes);
+               mapped_address = reinterpret_cast<char *>(pixel_buffer.map());
        }
        else if(phase==2)
        {
@@ -270,7 +270,12 @@ bool Texture2D::AsyncLoader::process()
                }
 
                if(!texture.id)
-                       glGenTextures(1, &texture.id);
+               {
+                       if(ARB_direct_state_access)
+                               glCreateTextures(texture.target, 1, &texture.id);
+                       else
+                               glGenTextures(1, &texture.id);
+               }
                texture.image(image, srgb_conversion, true);
        }