]> git.tdb.fi Git - libs/gl.git/commitdiff
Implement sub_image for Texture1D
authorMikko Rasa <tdb@tdb.fi>
Thu, 27 Oct 2016 07:58:35 +0000 (10:58 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 27 Oct 2016 07:58:35 +0000 (10:58 +0300)
source/texture1d.cpp
source/texture1d.h

index 043e0c0e1008bcc4346cc6852b42ad19d9f99e4a..a0ab79b943aef573e192edcc36e1e011fffb77c7 100644 (file)
@@ -57,6 +57,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)
index ee930a8721a80205507deed18c73536a7584efe4..0ab9c6f74734974e2716a7e8843b1e535e40a7d3 100644 (file)
@@ -32,6 +32,7 @@ public:
        void storage(PixelFormat, unsigned);
        void allocate(unsigned);
        void image(unsigned, PixelFormat, DataType, const void *);
+       void sub_image(unsigned, int, unsigned, PixelFormat, DataType, const void *);
        virtual void image(const Graphics::Image &, bool = false);
        unsigned get_width() const { return width; }