From 22ee56def5f956c98ffdb8064619730df1e1e538 Mon Sep 17 00:00:00 2001 From: jackun Date: Sat, 25 Apr 2020 13:13:05 +0300 Subject: [PATCH] [OpenGL] Use 32bit font texture until someone figures out why 8-bit looks worse --- src/gl/imgui_impl_opengl3.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gl/imgui_impl_opengl3.cpp b/src/gl/imgui_impl_opengl3.cpp index 56eef938..78f2a183 100644 --- a/src/gl/imgui_impl_opengl3.cpp +++ b/src/gl/imgui_impl_opengl3.cpp @@ -96,7 +96,7 @@ static bool ImGui_ImplOpenGL3_CreateFontsTexture() ImGuiIO& io = ImGui::GetIO(); unsigned char* pixels; int width, height; - io.Fonts->GetTexDataAsAlpha8(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory. + io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory. // Upload texture to graphics system GLint last_texture; @@ -109,7 +109,7 @@ static bool ImGui_ImplOpenGL3_CreateFontsTexture() if (g_IsGLES || g_GlVersion >= 2000) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, pixels); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); // Store our identifier io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture; @@ -249,7 +249,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects() "varying vec4 Frag_Color;\n" "void main()\n" "{\n" - " gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st).r;\n" + " gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n" "}\n"; const GLchar* fragment_shader_glsl_130 = @@ -259,7 +259,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects() "out vec4 Out_Color;\n" "void main()\n" "{\n" - " Out_Color = Frag_Color * texture(Texture, Frag_UV.st).r;\n" + " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" "}\n"; const GLchar* fragment_shader_glsl_300_es = @@ -270,7 +270,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects() "layout (location = 0) out vec4 Out_Color;\n" "void main()\n" "{\n" - " Out_Color = Frag_Color * texture(Texture, Frag_UV.st).r;\n" + " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" "}\n"; const GLchar* fragment_shader_glsl_410_core = @@ -280,7 +280,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects() "layout (location = 0) out vec4 Out_Color;\n" "void main()\n" "{\n" - " Out_Color = Frag_Color * texture(Texture, Frag_UV.st).r;\n" + " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" "}\n"; #ifndef NDEBUG