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
{
protected:
void displayProfileString(int xOffset,int yStart,char* message);
class CProfileIterator* m_profileIterator;

View File

@@ -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);
}
}

View File

@@ -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);