diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-02 10:59:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-02 10:59:27 +0400 |
commit | 941a8a25040b8fdce1ac0fbe11e6391e06b79c17 (patch) | |
tree | 6319d1f819393e70c1752c7fb3c8a750ade368b7 /source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | |
parent | 686b92f7b4ea71556a5cae61e24952bcec906602 (diff) |
[#18472] [patch] Speeding up Blenderplayer's profile drawing
from Mitchell Stokes (moguri)
Diffstat (limited to 'source/gameengine/GamePlayer/common/GPC_RenderTools.cpp')
-rw-r--r-- | source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index 8135635ddb3..eafdb8a96bb 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -29,6 +29,8 @@ #include "GL/glew.h" +#include "BMF_Api.h" + #include "DNA_scene_types.h" #include "RAS_IRenderTools.h" @@ -54,6 +56,7 @@ #include "GPC_RenderTools.h" + unsigned int GPC_RenderTools::m_numgllights; GPC_RenderTools::GPC_RenderTools() @@ -311,28 +314,19 @@ void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode, glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); - - // Actual drawing - unsigned char colors[2][3] = { - {0x00, 0x00, 0x00}, - {0xFF, 0xFF, 0xFF} - }; - int numTimes = mode == RAS_TEXT_PADDED ? 2 : 1; - for (int i = 0; i < numTimes; i++) { - glColor3ub(colors[i][0], colors[i][1], colors[i][2]); - glRasterPos2i(xco, yco); - for (p = s, lines = 0; *p; p++) { - if (*p == '\n') - { - lines++; - glRasterPos2i(xco, yco-(lines*18)); - } - BMF_DrawCharacter(m_font, *p); - } - xco += 1; - yco += 1; + + // Actual drawing (draw black first if padded) + if (mode == RAS_IRenderTools::RAS_TEXT_PADDED) + { + glColor3ub(0, 0, 0); + glRasterPos2s(xco+1, height-yco-1); + BMF_DrawString(m_font, s); } + glColor3ub(255, 255, 255); + glRasterPos2s(xco, height-yco); + BMF_DrawString(m_font, s); + // Restore view settings glMatrixMode(GL_PROJECTION); glPopMatrix(); |