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:
<pre>
glDisable;
glDisableClientState;
glDisableClientState;
m_b2dWorld~~>DrawDebugData();
// restore default GL states
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
Still nothing.
Anyone have any idea what I’ve missed or if this works, or anyone have it working?
Came across this as I am having some trouble with debugdraw as well. I’m using Box2d 2.2 and cocos2d 1.0. Basically it looks to me like some underlying things changed in the way box2d works with debugdraw object (?) and I’m curious if you’ve figured this out or if it’s a different problem.
Code:
@
in gamescene.h:
GLESDebugDraw *m_debugdraw;
in gamescene.m:
// Debug Draw functions
m_debugdraw = new GLESDebugDraw( PTM_RATIO );
world~~>SetDebugDraw; <~~b2world doesn’t like this, it’s looking for a b2draw object, not a GLESdebugdraw
Box2d version in both cocos2d-x & cocos2d-iphone is 2.1.2.
Maybe some interfaces are changed in 2.2, you had to rewrite this file: tests/Box2DTestBed/GLES-Render.cpp, use the same approach to implement the drawing interfaces of 2.2