cocos2d iphone - IOS Box2d version 2.1 DebugDraw not working -


i new box2d, have deal physics engine. creating fixtures , physics body , set position. want view physical objects in debug mode. have visited many forums , tried code, no luck.

i using following code after creating 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 override draw method , included gles_render.h well. there no compile errors physics objects in debug mode not showing.

-(void) draw {     [super draw];     ccglenablevertexattribs( kccvertexattribflag_position );     kmglpushmatrix();     _world->drawdebugdata();     kmglpopmatrix(); } 

how enable debug draw using cocos2d/box2d version 2.1 or there alternate way view physics objects ?

thanks

you should use glesdebugdraw when determining flags:

uint32 flags = 0;  flags += glesdebugdraw::e_shapebit; flags += glesdebugdraw::e_jointbit;  ..... debugdraw->setflags(flags); 

Comments