title: Bullet debug drawer with OpenGL
body: <p>I have been fiddling around with bullet for a bit and I now want to draw debug.
  I have an opengl world with working bullet physics and everything.</p>
  
  <p>What I have tried is this:
  I have created a class GLDebugDrawer like this:</p>
  
  <pre><code>#include "LinearMath/btIDebugDraw.h"
  
  class GLDebugDrawer : public btIDebugDraw
  {
     int m_debugMode;
  
  public:
  
     GLDebugDrawer();
     virtual ~GLDebugDrawer();
  
     virtual void   drawLine(const btVector3&amp; from, const btVector3&amp; to, const btVector3&amp; fromColor, const btVector3&amp; toColor);
  
     virtual void   drawLine(const btVector3&amp; from, const btVector3&amp; to, const btVector3&amp; color);
  
     virtual void   drawSphere(const btVector3&amp; p, btScalar radius, const btVector3&amp; color);
  
     virtual void   drawTriangle(const btVector3&amp; a, const btVector3&amp; b, const btVector3&amp; c, const btVector3&amp; color, btScalar alpha);
  
     virtual void   drawContactPoint(const btVector3&amp; PointOnB, const btVector3&amp; normalOnB, btScalar distance, int lifeTime, const btVector3&amp; color);
  
     virtual void   reportErrorWarning(const char* warningString);
  
     virtual void   draw3dText(const btVector3&amp; location, const char* textString);
  
     virtual void   setDebugMode(int debugMode);
  
     virtual int      getDebugMode() const { return m_debugMode; }
  
  };
  </code></pre>
  
  <p>Then in the game I include this header and create a instance of it.</p>
  
  <p>Where I initialize the bt world, I set the debug draw type like this:</p>
  
  <pre><code>debugDraw-&gt;DBG_DrawWireframe; // this breaks when I run the app
  debugDraw-&gt;setDebugMode(btIDebugDraw::DBG_DrawWireframe); // so does this
  debugDraw-&gt;setDebugMode(1); // this doesn't
  </code></pre>
  
  <p>I then set the debug to the bullet world like this:</p>
  
  <pre><code>bt_dynamicsWorld-&gt;setDebugDrawer(debugDraw);
  </code></pre>
  
  <p>And finally, I render the debug draw after I render the bullet bodies like this:</p>
  
  <pre><code>bt_dynamicsWorld-&gt;debugDrawWorld();
  </code></pre>
  
  <p>There must be something that I am missing as I am not getting any wireframes or anything when running.</p>