From e90e52294287452c7581088003a5b03df368f6aa Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 10 Feb 2012 05:10:52 +0000 Subject: bugfix [#30127] alpha in FontObjects not working in blenderplayer --- source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/gameengine') diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index b06a9783b50..03d3c8f909f 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -292,7 +292,7 @@ void GPC_RenderTools::RenderText3D( int fontid, float aspect) { /* the actual drawing */ - glColor3fv(color); + glColor4fv(color); BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT|BLF_TEXFILTER); /* multiply the text matrix by the object matrix */ -- cgit v1.2.3 From 17dadffd6688d44276ed59437e0344659d096c8f Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 10 Feb 2012 06:18:32 +0000 Subject: reverting commit [43876] Fix for aliased fonts in the game engine --- source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 4 ++-- source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 78dcfc8edd9..7a99a4a1419 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_TEXFILTER); + BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT); } 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 03d3c8f909f..55e3220c08c 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 */ 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 */ @@ -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_TEXFILTER); + BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT); glEnable(GL_DEPTH_TEST); } -- cgit v1.2.3 From 6a598148a7f42d7ef6496ed1b8f63178eb7ebaba Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 10 Feb 2012 07:52:21 +0000 Subject: bge font objects: fix for difference in size when object has a parent for after 2.62 I would like to try if using doubles would help to increase the precision here. Also now that the mipmap patch is reverted we may want to look at this problem from a different perspective. RES could be calculated taking the object size in relation to the camera (i.e. size and distance, ignoring rotation). That may solve both problems of wrong resolution and lack of smoothness. For the time being users still need to use object.resolution to fine tune the rendered text. --- source/gameengine/Ketsji/KX_FontObject.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 8cce9471587..519ff97a2a2 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -173,10 +173,10 @@ void KX_FontObject::DrawText() this->GetObjectColor().getValue(m_color); /* HARDCODED MULTIPLICATION FACTOR - this will affect the render resolution directly */ - float RES = BGE_FONT_RES * m_resolution; + const float RES = BGE_FONT_RES * m_resolution; - float size = m_fsize * m_object->size[0] * RES; - float aspect = 1.f / (m_object->size[0] * RES); + const float size = m_fsize * this->NodeGetWorldScaling()[0] * RES; + const float aspect = m_fsize / size; /* Get a working copy of the OpenGLMatrix to use */ double mat[16]; -- cgit v1.2.3