|
@@ -161,7 +161,7 @@ bool ImGui_ImplGlfw_CreateDeviceObjects()
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
unsigned char* pixels;
|
|
|
int width, height;
|
|
|
- io.Fonts->GetTexDataAsAlpha8(&pixels, &width, &height);
|
|
|
+ io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (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;
|
|
@@ -170,7 +170,7 @@ bool ImGui_ImplGlfw_CreateDeviceObjects()
|
|
|
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, 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 = (void *)(intptr_t)g_FontTexture;
|