]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture1d.cpp
Prefer sized internal formats when possible
[libs/gl.git] / source / texture1d.cpp
index 043e0c0e1008bcc4346cc6852b42ad19d9f99e4a..78c9ed0c54209a067c51516126b797289ddb82d4 100644 (file)
@@ -23,6 +23,9 @@ void Texture1D::storage(PixelFormat fmt, unsigned wd)
                throw invalid_operation("Texture1D::storage");
        if(wd==0)
                throw invalid_argument("Texture1D::storage");
+
+       if(MSP_sized_internal_formats)
+               fmt = get_sized_pixelformat(fmt);
        require_pixelformat(fmt);
 
        ifmt = fmt;
@@ -57,6 +60,17 @@ void Texture1D::image(unsigned level, PixelFormat fmt, DataType type, const void
        }
 }
 
+void Texture1D::sub_image(unsigned level, int x, unsigned wd, PixelFormat fmt, DataType type, const void *data)
+{
+       if(width==0)
+               throw invalid_operation("Texture3D::image");
+
+       allocate(level);
+
+       BindRestore _bind(this);
+       glTexSubImage1D(target, level, x, wd, fmt, type, data);
+}
+
 void Texture1D::image(const Graphics::Image &img, bool srgb)
 {
        if(img.get_height()!=1)