BLF: Fix broken shadows on certain hardware.

This was due to uninitialized texture space.
This commit is contained in:
Clément Foucault 2018-04-09 18:43:27 +02:00
parent c0ac908fe8
commit a74e782f5b
1 changed files with 5 additions and 1 deletions

View File

@ -242,7 +242,11 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, gc->p2_width, gc->p2_height, 0, GL_RED, GL_UNSIGNED_BYTE, NULL);
unsigned int pix_count = (unsigned int)(gc->p2_width * gc->p2_height);
unsigned char *pixels = MEM_callocN(pix_count * sizeof(*pixels), "BLF texture init");
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, gc->p2_width, gc->p2_height, 0, GL_RED, GL_UNSIGNED_BYTE, pixels);
MEM_freeN(pixels);
}
GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c)