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);
This commit is contained in:
erwin.coumans
2010-05-12 23:03:10 +00:00
parent f9445bdfde
commit b39abc4513
3 changed files with 17 additions and 2 deletions

View File

@@ -40,6 +40,7 @@ class btTypedConstraint;
class DemoApplication class DemoApplication
{ {
protected:
void displayProfileString(int xOffset,int yStart,char* message); void displayProfileString(int xOffset,int yStart,char* message);
class CProfileIterator* m_profileIterator; class CProfileIterator* m_profileIterator;

View File

@@ -81,6 +81,11 @@ void GLDebugResetFont(int screenWidth,int screenHeight)
#define USE_ARRAYS 1 #define USE_ARRAYS 1
void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3& rgb) 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) if (!sTexturesInitialized)
@@ -104,7 +109,14 @@ void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3&
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA,GL_ONE); glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glDepthFunc (GL_LEQUAL); glDepthFunc (GL_LEQUAL);
glEnable(GL_BLEND);
if (enableBlend)
{
glEnable(GL_BLEND);
} else
{
glDisable(GL_BLEND);
}
glEnable (GL_DEPTH_TEST); glEnable (GL_DEPTH_TEST);
glBindTexture(GL_TEXTURE_2D, sTexture); glBindTexture(GL_TEXTURE_2D, sTexture);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
@@ -178,7 +190,7 @@ void GLDebugDrawStringInternal(int x,int y,const char* string, const btVector3&
glEnd(); glEnd();
#endif #endif
glTranslatef(10,0,0); glTranslatef(spacing,0,0);
} }
} }

View File

@@ -19,6 +19,8 @@ subject to the following restrictions:
#include "LinearMath/btVector3.h" #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 GLDebugDrawStringInternal(int x,int y,const char* string,const btVector3& rgb);
void GLDebugDrawString(int x,int y,const char* string); void GLDebugDrawString(int x,int y,const char* string);
void GLDebugResetFont(int screenWidth,int screenHeight); void GLDebugResetFont(int screenWidth,int screenHeight);