Is there any example of bullet debug drawing, or could somebody explain me what exactly the manual means?
I have tried to understand the way it works from the examples but I do not seem to be able to create my own code on this.
Debug Drawing Help
-
jstolarz
- Posts: 14
- Joined: Thu Dec 09, 2010 9:32 pm
- Location: Glendale, California
Re: Debug Drawing Help
For examples, in the demo code, look at Demos/OpenGL/GLDebugDrawer.h/.cpp.
Essentially, you need to build a class the inherits from btIDebugDraw (http://www.continuousphysics.com/Bullet ... gDraw.html). Then you need to implement a few of the virtual functions:
setDebugMode
getDebugMode
reportErrorWarning
draw3dText
drawLine
drawContactPoint
In my case, some of these (like draw3dText) are just stubs for now.
Once that's done, just register it with your collision/dynamics world:
and call
once you've made a collision/dynamics step.
Essentially, you need to build a class the inherits from btIDebugDraw (http://www.continuousphysics.com/Bullet ... gDraw.html). Then you need to implement a few of the virtual functions:
setDebugMode
getDebugMode
reportErrorWarning
draw3dText
drawLine
drawContactPoint
In my case, some of these (like draw3dText) are just stubs for now.
Once that's done, just register it with your collision/dynamics world:
Code: Select all
world->setDebugDrawer(&yourDebugDrawClass)Code: Select all
world->debugDrawWorld()-
Killcam
- Posts: 11
- Joined: Tue Nov 09, 2010 7:03 pm
Re: Debug Drawing Help
Thank you, I'll try as soon as I have some time.
-
Killcam
- Posts: 11
- Joined: Tue Nov 09, 2010 7:03 pm
Re: Debug Drawing Help
Sorry for double-posting, but I would like to ask one more thing. Should I be able to use the "public btIDebugDraw" as a default one instead of building a new one?
-
jstolarz
- Posts: 14
- Joined: Thu Dec 09, 2010 9:32 pm
- Location: Glendale, California
Re: Debug Drawing Help
Nope, because it has the above mentioned virtual functions that you must define. Bullet has no knowledge of how you'd like to render things out, or where to do it. Oh I should mention that in the above post I forgot about the calls to setDebugMode() that you'll want to make in order to decide what to display.