diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-09-02 07:14:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-09-02 07:14:38 +0400 |
commit | a0229b21cb5cfc6e263cc2396d5b1e8530d9d38d (patch) | |
tree | 1f1c5e6401d0fe14458db6762886ba31fe1129f8 /source/gameengine/BlenderRoutines | |
parent | 32b2b1f544661f6dee4a81428b562fe7a3bc3f13 (diff) |
text display (debug info) in the game engine working again & other minor changes.
Diffstat (limited to 'source/gameengine/BlenderRoutines')
-rw-r--r-- | source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 34 | ||||
-rw-r--r-- | source/gameengine/BlenderRoutines/KX_BlenderGL.h | 4 | ||||
-rw-r--r-- | source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp | 8 |
3 files changed, 16 insertions, 30 deletions
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 5cf696fe146..dba6d1113c9 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -103,6 +103,8 @@ void BL_SwapBuffers(wmWindow *win) void DisableForText() { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */ + if(glIsEnabled(GL_BLEND)) glDisable(GL_BLEND); if(glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST); @@ -135,32 +137,25 @@ void DisableForText() } } -void BL_print_gamedebug_line(char* text, int xco, int yco, int width, int height) +void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height) { /* gl prepping */ DisableForText(); - //glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); - - glOrtho(0, width, - 0, height, 0, 1); - + + glOrtho(0, width, 0, height, -100, 100); + glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - glLoadIdentity(); /* the actual drawing */ glColor3ub(255, 255, 255); - BLF_draw_default(xco, height-yco, 0.0f, text); + BLF_draw_default(xco, height-yco, 0.0f, (char *)text); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); @@ -168,36 +163,29 @@ void BL_print_gamedebug_line(char* text, int xco, int yco, int width, int height glEnable(GL_DEPTH_TEST); } -void BL_print_gamedebug_line_padded(char* text, int xco, int yco, int width, int height) +void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int width, int height) { /* This is a rather important line :( The gl-mode hasn't been left * behind quite as neatly as we'd have wanted to. I don't know * what cause it, though :/ .*/ DisableForText(); - //glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); - glOrtho(0, width, - 0, height, 0, 1); + glOrtho(0, width, 0, height, -100, 100); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - glLoadIdentity(); /* draw in black first*/ glColor3ub(0, 0, 0); - BLF_draw_default(xco+1, height-yco-1, 0.0f, text); + BLF_draw_default(xco+2, height-yco-2, 0.0f, (char *)text); glColor3ub(255, 255, 255); - BLF_draw_default(xco, height-yco, 0.0f, text); + BLF_draw_default(xco, height-yco, 0.0f, (char *)text); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h index 1e65f29d87c..5c947ff630e 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.h @@ -47,8 +47,8 @@ void BL_HideMouse(); void BL_NormalMouse(); void BL_WaitMouse(); -void BL_print_gamedebug_line(char* text, int xco, int yco, int width, int height); -void BL_print_gamedebug_line_padded(char* text, int xco, int yco, int width, int height); +void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height); +void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int width, int height); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp index 8ed36e860b4..ee9dae14b9b 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp @@ -284,12 +284,10 @@ void KX_BlenderRenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode, int width, int height) { - STR_String tmpstr(text); - if(mode == RAS_IRenderTools::RAS_TEXT_PADDED) - BL_print_gamedebug_line_padded(tmpstr.Ptr(), xco, yco, width, height); + BL_print_gamedebug_line_padded(text, xco, yco, width, height); else - BL_print_gamedebug_line(tmpstr.Ptr(), xco, yco, width, height); + BL_print_gamedebug_line(text, xco, yco, width, height); } /* Render Text renders text into a (series of) polygon, using a texture font, @@ -390,4 +388,4 @@ void KX_BlenderRenderTools::Update2DFilter(vector<STR_String>& propNames, void* void KX_BlenderRenderTools::Render2DFilters(RAS_ICanvas* canvas) { m_filtermanager.RenderFilters(canvas); -}
\ No newline at end of file +} |