]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture1d.cpp
Rearrange texture bind calls to keep them closer to where they're needed
[libs/gl.git] / source / texture1d.cpp
index e5a496a455095093c89502d15c3727dd7306ecec..ed7d8f6e2b877fd4f660d71dbdc72874ef3de34b 100644 (file)
@@ -59,10 +59,10 @@ void Texture1D::image(unsigned level, PixelFormat fmt, DataType type, const void
 
        unsigned w = get_level_size(level);
 
-       BindRestore _bind(this);
        if(ARB_texture_storage)
                return sub_image(level, 0, w, fmt, type, data);
 
+       BindRestore _bind(this);
        glTexImage1D(target, level, ifmt, w, 0, fmt, type, data);
 
        allocated |= 1<<level;
@@ -78,9 +78,9 @@ void Texture1D::sub_image(unsigned level, int x, unsigned wd, PixelFormat fmt, D
        if(width==0)
                throw invalid_operation("Texture3D::image");
 
+       BindRestore _bind(this);
        allocate(level);
 
-       BindRestore _bind(this);
        glTexSubImage1D(target, level, x, wd, fmt, type, data);
 
        if(gen_mipmap && level==0)