texture mipmap fix
parent
709db71827
commit
129f6e3fb9
|
@ -173,7 +173,9 @@ namespace blt::gfx
|
|||
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, GLint dataMode = GL_UNSIGNED_BYTE) const;
|
||||
|
||||
void upload(const texture_file& tex_file) const;
|
||||
void upload(void* data, int width, int height, GLint dataColorMode = GL_RGBA, GLint dataMode = GL_UNSIGNED_BYTE);
|
||||
|
||||
void upload(const texture_data& file_data) const;
|
||||
|
||||
/**
|
||||
* Resizes the internal memory for the texture but does NOT resize the texture image stored
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0fbe3bf2281aaa091173d7acd1cc017b3d60bf7b
|
||||
Subproject commit a0b92ddfa756ddf80e280e1af37a057dd0d41cf9
|
|
@ -104,12 +104,13 @@ void blt::gfx::texture_gl2D::upload(void* data, GLint dataColorMode, int level,
|
|||
sub_height = m_height;
|
||||
bind();
|
||||
glTexSubImage2D(textureBindType, level, x_offset, y_offset, sub_width, sub_height, dataColorMode, dataMode, data);
|
||||
generateMipmaps();
|
||||
unbind();
|
||||
}
|
||||
|
||||
void blt::gfx::texture_gl2D::upload(const blt::gfx::texture_file& tex_file) const
|
||||
void blt::gfx::texture_gl2D::upload(const blt::gfx::texture_data& file_data) const
|
||||
{
|
||||
upload(tex_file.texture().data(), tex_file.channels() == 4 ? GL_RGBA : GL_RGB, 0, 0, 0, tex_file.width(), tex_file.height());
|
||||
upload((void*)file_data.data(), file_data.channels() == 4 ? GL_RGBA : GL_RGB, 0, 0, 0, file_data.width(), file_data.height());
|
||||
}
|
||||
|
||||
void blt::gfx::texture_gl2D::resize(int width, int height)
|
||||
|
@ -142,6 +143,14 @@ blt::gfx::texture_gl2D::texture_gl2D(const blt::gfx::texture_data& data): textur
|
|||
unbind();
|
||||
}
|
||||
|
||||
void blt::gfx::texture_gl2D::upload(void* data, int width, int height, GLint dataColorMode, GLint dataMode)
|
||||
{
|
||||
bind();
|
||||
glTexImage2D(textureBindType, 0, textureColorMode, width, height, 0, dataColorMode, dataMode, data);
|
||||
generateMipmaps();
|
||||
unbind();
|
||||
}
|
||||
|
||||
void blt::gfx::gl_texture2D_array::upload(void* data, int index, GLint dataColorMode, int level, int x_offset, int y_offset, int sub_width,
|
||||
int sub_height) const
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue