]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture1d.cpp
Use the correct form of glTexParameter to set maximum anisotropy
[libs/gl.git] / source / texture1d.cpp
index 44e49f51142fde02d41fa4da16b5119cb129d840..ed7d8f6e2b877fd4f660d71dbdc72874ef3de34b 100644 (file)
@@ -59,11 +59,11 @@ void Texture1D::image(unsigned level, PixelFormat fmt, DataType type, const void
 
        unsigned w = get_level_size(level);
 
-       BindRestore _bind(this);
        if(ARB_texture_storage)
-               sub_image(level, 0, w, fmt, type, data);
-       else
-               glTexImage1D(target, level, ifmt, w, 0, fmt, type, data);
+               return sub_image(level, 0, w, fmt, type, data);
+
+       BindRestore _bind(this);
+       glTexImage1D(target, level, ifmt, w, 0, fmt, type, data);
 
        allocated |= 1<<level;
        if(gen_mipmap && level==0)
@@ -78,10 +78,13 @@ 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)
+               auto_generate_mipmap();
 }
 
 void Texture1D::image(const Graphics::Image &img, bool srgb)