Use GL_LUMINANCE_ALPHA instead of GL_ALPHA
GL_ALPHA sets the RGB values to 0.0, but I want them set to 1.0
This commit is contained in:
parent
348a691c6c
commit
64f7a2eae3
1 changed files with 4 additions and 2 deletions
|
@ -428,7 +428,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width
|
||||||
if (glyph == NULL)
|
if (glyph == NULL)
|
||||||
return 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);
|
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)
|
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);
|
*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)
|
for (unsigned int x = 0; x < width; ++x)
|
||||||
{
|
{
|
||||||
|
*destination_pointer++ = 0xFF;
|
||||||
*destination_pointer++ = *source_pointer++ ? 0xFF : 0;
|
*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);
|
glGenTextures(1, &glyph->texture_id);
|
||||||
glBindTexture(GL_TEXTURE_2D, 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_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue