Use texture compression on GPU

This commit is contained in:
Enrico Turri 2019-05-21 14:19:03 +02:00
parent 5afd0b4ee2
commit efd247fc58
6 changed files with 102 additions and 21 deletions

View file

@ -373,7 +373,14 @@ void ImGuiWrapper::init_font()
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
glsafe(::glPixelStorei(GL_UNPACK_ROW_LENGTH, 0));
#if ENABLE_COMPRESSED_TEXTURES
if (GLEW_EXT_texture_compression_s3tc)
glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
else
glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
#else
glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
#endif // ENABLE_COMPRESSED_TEXTURES
// Store our identifier
io.Fonts->TexID = (ImTextureID)(intptr_t)m_font_texture;