diff options
author | Alex Fraser <alex@phatcore.com> | 2012-02-04 05:51:59 +0400 |
---|---|---|
committer | Alex Fraser <alex@phatcore.com> | 2012-02-04 05:51:59 +0400 |
commit | a05fdb837b89f2fba04587e99d0eecaa9cf174c3 (patch) | |
tree | 3739d95c3a2b10d1ae7cc8a0723ba3cb19924e0a /source/gameengine | |
parent | dc97e07134c48aacf5e3de4436d70e7b71fbecaa (diff) |
Fix for aliased fonts in the game engine.
- Mipmaps are generated in BLF when drawing text in-game. In that case, padding around each glyph is increased to prevent bleeding.
- Texture filtering is turned on for in-game text.
- All glyphs are now "twisted": the leading edge is brought a small distance forward, to prevent z-fighting in overlapping (kerned) glyphs. This happens both in the game engine and the rest of the UI, but should have no effect in the UI due to Z-compression in the clipping matrix.
Reviewed and approved by bdiego; see patch [#29882] in the tracker. Tested by dfelinto.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 7a99a4a1419..78dcfc8edd9 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -136,8 +136,8 @@ void BL_print_game_line(int fontid, const char* text, int size, int dpi, float* /* the actual drawing */ glColor4fv(color); + BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER); /* multiply the text matrix by the object matrix */ - BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT); BLF_matrix(fontid, mat); /* aspect is the inverse scale that allows you to increase */ @@ -149,7 +149,7 @@ void BL_print_game_line(int fontid, const char* text, int size, int dpi, float* BLF_position(fontid, 0, 0, 0); BLF_draw(fontid, (char *)text, 65535); - BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT); + BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER); } void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height) diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index ffa2cb38b87..b06a9783b50 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -294,8 +294,8 @@ void GPC_RenderTools::RenderText3D( int fontid, /* the actual drawing */ glColor3fv(color); + BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER); /* multiply the text matrix by the object matrix */ - BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT); BLF_matrix(fontid, mat); /* aspect is the inverse scale that allows you to increase */ @@ -307,7 +307,7 @@ void GPC_RenderTools::RenderText3D( int fontid, BLF_position(fontid, 0, 0, 0); BLF_draw(fontid, text, 65535); - BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT); + BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER); glEnable(GL_DEPTH_TEST); } |