[#18472] [patch] Speeding up Blenderplayer's profile drawing
authorCampbell Barton <ideasman42@gmail.com>
Thu, 2 Apr 2009 06:59:27 +0000 (06:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 2 Apr 2009 06:59:27 +0000 (06:59 +0000)
from Mitchell Stokes (moguri)

source/gameengine/GamePlayer/common/GPC_RenderTools.cpp

index 8135635ddb3d5a5940809b6e2e1d8c8671d2b49d..eafdb8a96bb21031166b84da040505866e2cc6b0 100644 (file)
@@ -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();