From a74e782f5b3e1df763274e3c8f803562dbbd9a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 9 Apr 2018 18:43:27 +0200 Subject: BLF: Fix broken shadows on certain hardware. This was due to uninitialized texture space. --- source/blender/blenfont/intern/blf_glyph.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/blenfont') 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) -- cgit v1.2.3