From b39abc45137df22a85eebf9f5393c8cf88904fcb Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Wed, 12 May 2010 23:03:10 +0000 Subject: [PATCH] minor addition to GLDebugFont for non-blender text rendering (better readable on top of existing graphics) Use GLDebugDrawStringInternal(xcoord,ycoord,text,rgb_color,use_blending,character_spacing); --- Demos/OpenGL/DemoApplication.h | 1 + Demos/OpenGL/GLDebugFont.cpp | 16 ++++++++++++++-- Demos/OpenGL/GLDebugFont.h | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Demos/OpenGL/DemoApplication.h b/Demos/OpenGL/DemoApplication.h index ef6a26799..cfd23ebc8 100644 --- a/Demos/OpenGL/DemoApplication.h +++ b/Demos/OpenGL/DemoApplication.h @@ -40,6 +40,7 @@ class btTypedConstraint; class DemoApplication { +protected: void displayProfileString(int xOffset,int yStart,char* message); class CProfileIterator* m_profileIterator; diff --git a/Demos/OpenGL/GLDebugFont.cpp b/Demos/OpenGL/GLDebugFont.cpp index c7f69a4b7..8dcb040f4 100644 --- a/Demos/OpenGL/GLDebugFont.cpp +++ b/Demos/OpenGL/GLDebugFont.cpp @@ -81,6 +81,11 @@ void GLDebugResetFont(int screenWidth,int screenHeight) #define USE_ARRAYS 1 void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3& rgb) +{ + GLDebugDrawStringInternal(x,y,string,rgb,true,10); +} + +void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3& rgb, bool enableBlend, int spacing) { if (!sTexturesInitialized) @@ -104,7 +109,14 @@ void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3& glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA,GL_ONE); glDepthFunc (GL_LEQUAL); - glEnable(GL_BLEND); + + if (enableBlend) + { + glEnable(GL_BLEND); + } else + { + glDisable(GL_BLEND); + } glEnable (GL_DEPTH_TEST); glBindTexture(GL_TEXTURE_2D, sTexture); glDisable(GL_DEPTH_TEST); @@ -178,7 +190,7 @@ void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3& glEnd(); #endif - glTranslatef(10,0,0); + glTranslatef(spacing,0,0); } } diff --git a/Demos/OpenGL/GLDebugFont.h b/Demos/OpenGL/GLDebugFont.h index 858062227..bf2c2575d 100644 --- a/Demos/OpenGL/GLDebugFont.h +++ b/Demos/OpenGL/GLDebugFont.h @@ -19,6 +19,8 @@ subject to the following restrictions: #include "LinearMath/btVector3.h" + +void GLDebugDrawStringInternal(int x,int y,const char* string,const btVector3& rgb, bool enableBlend, int spacing); void GLDebugDrawStringInternal(int x,int y,const char* string,const btVector3& rgb); void GLDebugDrawString(int x,int y,const char* string); void GLDebugResetFont(int screenWidth,int screenHeight);