From: Mikko Rasa Date: Thu, 27 Oct 2016 07:58:35 +0000 (+0300) Subject: Implement sub_image for Texture1D X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=4a6c595b4d954b6cf69c6388a43b2b66f84d8c0a;p=libs%2Fgl.git Implement sub_image for Texture1D --- diff --git a/source/texture1d.cpp b/source/texture1d.cpp index 043e0c0e..a0ab79b9 100644 --- a/source/texture1d.cpp +++ b/source/texture1d.cpp @@ -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) diff --git a/source/texture1d.h b/source/texture1d.h index ee930a87..0ab9c6f7 100644 --- a/source/texture1d.h +++ b/source/texture1d.h @@ -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; }