diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-04-09 19:43:27 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-04-10 11:26:09 +0300 |
commit | a74e782f5b3e1df763274e3c8f803562dbbd9a89 (patch) | |
tree | a9c61170182e8cb7ee8652a6ca352667d17c122c /source/blender/blenfont | |
parent | c0ac908fe864a6156a7307859f6b4744f532c927 (diff) |
BLF: Fix broken shadows on certain hardware.
This was due to uninitialized texture space.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 6ab95e0a59a..da9aeaed449 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -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) |