upload type

main
Brett 2024-01-17 16:03:07 -05:00
parent 04665fa5c7
commit f821c7c8d1
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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();
}