From 4a6c595b4d954b6cf69c6388a43b2b66f84d8c0a Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 27 Oct 2016 10:58:35 +0300 Subject: [PATCH] Implement sub_image for Texture1D --- source/texture1d.cpp | 11 +++++++++++ source/texture1d.h | 1 + 2 files changed, 12 insertions(+) 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; } -- 2.43.0