From b167f69ca2e1bd231b39b1790815be5f9cbecab9 Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Tue, 1 Mar 2011 00:49:36 +0000 Subject: [PATCH] add debug text/info for Demos/InternalEdgeDemo --- Demos/InternalEdgeDemo/InternalEdgeDemo.cpp | 35 ++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Demos/InternalEdgeDemo/InternalEdgeDemo.cpp b/Demos/InternalEdgeDemo/InternalEdgeDemo.cpp index e0e73163c..264092261 100644 --- a/Demos/InternalEdgeDemo/InternalEdgeDemo.cpp +++ b/Demos/InternalEdgeDemo/InternalEdgeDemo.cpp @@ -12,7 +12,7 @@ subject to the following restrictions: 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - +#include "GLDebugFont.h" //#define SHIFT_INDICES 1 @@ -399,6 +399,8 @@ void InternalEdgeDemo::initPhysics() staticBody->setCollisionFlags(staticBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK); getDynamicsWorld()->setDebugDrawer(&gDebugDrawer); + setDebugMode(btIDebugDraw::DBG_DrawText|btIDebugDraw::DBG_NoHelpText); + #ifdef BT_INTERNAL_EDGE_DEBUG_DRAW btSetDebugDrawer(&gDebugDrawer); @@ -483,6 +485,37 @@ void InternalEdgeDemo::clientMoveAndDisplay() //optional but useful: debug drawing m_dynamicsWorld->debugDrawWorld(); + int lineWidth=450; + int xStart = m_glutScreenWidth - lineWidth; + int yStart = 20; + + if((getDebugMode() & btIDebugDraw::DBG_DrawText)!=0) + { + setOrthographicProjection(); + glDisable(GL_LIGHTING); + glColor3f(0, 0, 0); + char buf[124]; + + glRasterPos3f(xStart, yStart, 0); + if (enable) + { + sprintf(buf,"InternalEdgeUtility enabled"); + } else + { + sprintf(buf,"InternalEdgeUtility disabled"); + } + GLDebugDrawString(xStart,20,buf); + yStart+=20; + glRasterPos3f(xStart, yStart, 0); + sprintf(buf,"Press 'n' to toggle InternalEdgeUtility"); + yStart+=20; + GLDebugDrawString(xStart,yStart,buf); + glRasterPos3f(xStart, yStart, 0); + + resetPerspectiveProjection(); + glEnable(GL_LIGHTING); + } + renderme();