From f821c7c8d191a8eb8a58fc396b8dfa9dd40bba4d Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Wed, 17 Jan 2024 16:03:07 -0500 Subject: [PATCH] upload type --- include/blt/gfx/texture.h | 2 +- src/blt/gfx/texture.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/blt/gfx/texture.h b/include/blt/gfx/texture.h index efc7e40..68b1be3 100644 --- a/include/blt/gfx/texture.h +++ b/include/blt/gfx/texture.h @@ -171,7 +171,7 @@ namespace blt::gfx texture_gl2D(int width, int height, GLint colorMode = GL_RGBA8); void upload(void* data, GLint dataColorMode = GL_RGBA, int level = 0, int x_offset = 0, int y_offset = 0, int sub_width = -1, - int sub_height = -1) const; + int sub_height = -1, GLint dataMode = GL_UNSIGNED_BYTE) const; void upload(const texture_file& tex_file) const; diff --git a/src/blt/gfx/texture.cpp b/src/blt/gfx/texture.cpp index c2ec470..2f7504d 100644 --- a/src/blt/gfx/texture.cpp +++ b/src/blt/gfx/texture.cpp @@ -95,14 +95,15 @@ void blt::gfx::texture_gl::setDefaults() const #endif } -void blt::gfx::texture_gl2D::upload(void* data, GLint dataColorMode, int level, int x_offset, int y_offset, int sub_width, int sub_height) const +void blt::gfx::texture_gl2D::upload(void* data, GLint dataColorMode, int level, int x_offset, int y_offset, int sub_width, int sub_height, + GLint dataMode) const { if (sub_width < 0) sub_width = m_width; if (sub_height < 0) sub_height = m_height; bind(); - glTexSubImage2D(textureBindType, level, x_offset, y_offset, sub_width, sub_height, dataColorMode, GL_UNSIGNED_BYTE, data); + glTexSubImage2D(textureBindType, level, x_offset, y_offset, sub_width, sub_height, dataColorMode, dataMode, data); unbind(); }