diff options
author | Diego Borghetti <bdiego@gmail.com> | 2012-01-03 23:41:36 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2012-01-03 23:41:36 +0400 |
commit | b197a7ea698eac7fc671a985f672948a9a842791 (patch) | |
tree | 5bfd62e19456ff23faadf88fa6a91dc8489fff9d /source/blender/blenfont/intern/blf_glyph.c | |
parent | ea9f5e3d2af34894660ada7efcbfe0d291333db1 (diff) |
Fix:
[#25834] no color of textobjects in game engine when combined with
textured objects
[#26893] Curruption of displayed text (debug properties/fps info or bgui)
when using animated/tile uv mode
The first bug was beacuse a bad mode on the texture environment, now
we save the current glTexEnvi, set the one that we need, draw and
restore the original at the end.
The second was because a missing call to glLoadIdentity for the
texture matrix and as we do before, now we do a gl-Push/Identity/Pop
for this matrix to.
The first problem was solved by Kanttori and the second by Dalai.
Diffstat (limited to 'source/blender/blenfont/intern/blf_glyph.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index f0cfcdc97b9..f8c589a7051 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -368,6 +368,7 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) float dx, dx1; float y1, y2; float xo, yo; + GLint param; if ((!g->width) || (!g->height)) return 1; @@ -449,6 +450,11 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= g->tex)); } + /* Save the current parameter to restore it later. */ + glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, ¶m); + if (param != GL_MODULATE) + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + if (font->flags & BLF_SHADOW) { switch(font->shadow) { @@ -487,5 +493,9 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) break; } + /* and restore the original value. */ + if (param != GL_MODULATE) + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param); + return 1; } |