I’m trying to add Box2D debug draw to my project. I’m using Box2D just for collision detection as in this article here; http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone
It’s nearly all working and I’m trying to turn on the debug draw to iron out a few bugs….
I added :-
m_b2dDebugDraw = new GLESDebugDraw( PTM_RATIO );
uint32 flags = 0;
flags += b2DebugDraw::e_shapeBit;
flags += b2DebugDraw::e_jointBit;
flags += b2DebugDraw::e_aabbBit;
flags += b2DebugDraw::e_pairBit;
flags += b2DebugDraw::e_centerOfMassBit;
Though I did find “GLESDebugDraw” wasn’t in the cocos2dx build, I found the GLESDebugDraw class in the file GLES-Render.cpp in the tests samples…. which is a bit suspicious…
And I added a call to "m_b2dWorld~~>DrawDebugData;" to make the draw happen after my box2d update, which I traced and it seems to happen with a number of “DrawShape(f, xf, b2Color(0.6f, 0.6f, 0.6f));”’s in the DrawDebuData being called though they are with small vertices values which I think is actually correct for the the GL projection. But nothing appeared on the screen, tried calling the draw after everything, before everything, still nothing appears.
I even tried this:
// restore default GL states
Anyone have any idea what I’ve missed or if this works, or anyone have it working?