]> git.tdb.fi Git - libs/gl.git/commitdiff
Implement sub_image for TextureCube also
authorMikko Rasa <tdb@tdb.fi>
Thu, 27 Oct 2016 22:38:34 +0000 (01:38 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 27 Oct 2016 22:39:14 +0000 (01:39 +0300)
I thought it was already implemented but in turned out there was only a
declaration.

source/texturecube.cpp

index 889d051b905e490dc9006f993a24fc476871d5c5..26402695880dc12eba847ccb443fa8cb90fbb02c 100644 (file)
@@ -80,6 +80,17 @@ void TextureCube::image(TextureCubeFace face, unsigned level, PixelFormat fmt, D
        }
 }
 
+void TextureCube::sub_image(TextureCubeFace face, unsigned level, int x, int y, unsigned wd, unsigned ht, PixelFormat fmt, DataType type, const void *data)
+{
+       if(size==0)
+               throw invalid_operation("TextureCube::sub_image");
+
+       allocate(level);
+
+       BindRestore _bind(this);
+       glTexSubImage2D(face, level, x, y, wd, ht, fmt, type, data);
+}
+
 void TextureCube::image(TextureCubeFace face, const Graphics::Image &img, bool srgb)
 {
        unsigned w = img.get_width();