diff --git a/src/Backends/Rendering/OpenGL2.cpp b/src/Backends/Rendering/OpenGL2.cpp index bf34eb58..21327e5c 100644 --- a/src/Backends/Rendering/OpenGL2.cpp +++ b/src/Backends/Rendering/OpenGL2.cpp @@ -428,7 +428,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width if (glyph == NULL) return NULL; - const int destination_pitch = (width + 3) & ~3; // Round up to the nearest 4 (OpenGL needs this) + const int destination_pitch = ((width * 2) + 3) & ~3; // Round up to the nearest 4 (OpenGL needs this) unsigned char *buffer = (unsigned char*)malloc(destination_pitch * height); @@ -450,6 +450,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width for (unsigned int x = 0; x < width; ++x) { + *destination_pointer++ = 0xFF; *destination_pointer++ = (unsigned char)(pow((double)*source_pointer++ / (total_greys - 1), 1.0 / 1.8) * 255.0); } } @@ -464,6 +465,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width for (unsigned int x = 0; x < width; ++x) { + *destination_pointer++ = 0xFF; *destination_pointer++ = *source_pointer++ ? 0xFF : 0; } } @@ -473,7 +475,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width glGenTextures(1, &glyph->texture_id); glBindTexture(GL_TEXTURE_2D, glyph->texture_id); - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA8, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, buffer); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8_ALPHA8, width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, buffer); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);