I am new to box2d, i have to deal with the Physics Engine. i am creating fixtures and Physics body and set position. Now i want to view physical objects in Debug Mode. i have visited many forums and tried code, but no luck.
i am using the following code after creating my world
m_debugDraw = new GLESDebugDraw( PTM_RATIO );
_world->SetDebugDraw(m_debugDraw);
uint32 flags = 0;
flags += b2Draw::e_shapeBit;
flags += b2Draw::e_jointBit;
flags += b2Draw::e_aabbBit;
flags += b2Draw::e_pairBit;
flags += b2Draw::e_centerOfMassBit;
m_debugDraw->SetFlags(flags);
and also override the Draw method and included GLES_Render.h as well. there are no compile errors but Physics objects in debug mode are not showing.
-(void) draw
{
[super draw];
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
_world->DrawDebugData();
kmGLPopMatrix();
}
how to enable Debug Draw using cocos2d/Box2d version 2.1 OR is there any alternate way to view physics objects ?
Thanks