[Bf-blender-cvs] [a74e782f5b3] blender2.8: BLF: Fix broken shadows on certain hardware.

Clément Foucault noreply at git.blender.org
Tue Apr 10 10:26:12 CEST 2018


Commit: a74e782f5b3e1df763274e3c8f803562dbbd9a89
Author: Clément Foucault
Date:   Mon Apr 9 18:43:27 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa74e782f5b3e1df763274e3c8f803562dbbd9a89

BLF: Fix broken shadows on certain hardware.

This was due to uninitialized texture space.

===================================================================

M	source/blender/blenfont/intern/blf_glyph.c

===================================================================

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)



More information about the Bf-blender-cvs mailing list