[OpenGL] Use GL_R8 for font textures
Randomly getting squares with GL_ALPHA for some reason
@@ -125,14 +125,7 @@ static bool ImGui_ImplOpenGL3_CreateFontsTexture()
if (g_IsGLES || g_GlVersion >= 200)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- // FIXME can compress?
- glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels);
-
-#ifndef NDEBUG
- GLint compFlag= 0;
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED, &compFlag);
- fprintf(stderr, "GL tex compressed: %s\n", compFlag ? "yes" : "no");
-#endif
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, pixels);
// Store our identifier
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
@@ -261,7 +254,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
"varying vec4 Frag_Color;\n"
"void main()\n"
"{\n"
- " gl_FragColor = Frag_Color * vec4(1, 1, 1, texture2D(Texture, Frag_UV.st).a);\n"
+ " gl_FragColor = Frag_Color * vec4(1, 1, 1, texture2D(Texture, Frag_UV.st).r);\n"
"}\n";
const GLchar* fragment_shader_glsl_130 =
@@ -271,7 +264,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
"out vec4 Out_Color;\n"
"void main()\n"
"{\n"
- " Out_Color = Frag_Color * vec4(1, 1, 1, texture(Texture, Frag_UV.st).a);\n"
+ " Out_Color = Frag_Color * vec4(1, 1, 1, texture(Texture, Frag_UV.st).r);\n"
"}\n";
const GLchar* fragment_shader_glsl_300_es =
@@ -282,7 +275,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
"layout (location = 0) out vec4 Out_Color;\n"
"void main()\n"
"{\n"
- " Out_Color = Frag_Color * vec4(1, 1, 1, texture(Texture, Frag_UV.st).a);\n"
+ " Out_Color = Frag_Color * vec4(1, 1, 1, texture(Texture, Frag_UV.st).r);\n"
"}\n";
const GLchar* fragment_shader_glsl_410_core =
@@ -292,7 +285,7 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
"layout (location = 0) out vec4 Out_Color;\n"
"void main()\n"
"{\n"
- " Out_Color = Frag_Color * vec4(1, 1, 1, texture(Texture, Frag_UV.st).a);\n"
+ " Out_Color = Frag_Color * vec4(1, 1, 1, texture(Texture, Frag_UV.st).r);\n"
"}\n";
#ifndef NDEBUG
