# Box2d debug render

How can I render the body and joints in the physics world? During research I found the class called Box2dDebugRenderer. But when I put it into use it was full of errors. I do not found some classed in it. My basic requirement is to draw a body that were available in the physics world. Please provide some guidance on that. Also provide any other view about that.

With my limited experience with physics engines, the developer is required to implement their own drawing code for that the physics engine then uses for debug drawing.

It's usually broken down into simple methods for you to implement like line(float startX, float startY, float endX, float endY), where you need to implement the functionality to draw the line specified. This might be the reason for it being "full of errors", but without more information it's hard to tell.

You can take a look at libgdx to see how it's been implemented there. And look into the ShapeRenderer they employ here.

• No need to reimplement this, it was done three times now and using it is as simple as mScene.attachChild(new Box2dDebugRenderer(mPhysicsWorld)); – JohnEye May 30 '12 at 16:02
• Thanks @JohnEye I should probably let you answer first from here on :) – MichaelHouse May 30 '12 at 16:12

What version of AndEngine are you using? GLES1 or GLES2? It is likely that you are trying to use an outdated version.

If GLES1, the code here works just fine. I linked it to my GLES1 project today.

I you use GLES2, there is a thread about it over at the AndEngine forums.

Please note that using this will make your app run quite slow.

• I did not found any thing useful to me. The downloaded extension contains an error and anything does not found in the bin folder except res folder – Siddharth May 31 '12 at 5:12
• Again, you need to specify the version of AndEngine you use. – JohnEye May 31 '12 at 11:27
• I downloaded the lastest andEngine version from the site but when I import the project it also contains an error and the bin folder was empty without any jar file. – Siddharth Jun 1 '12 at 5:06
• I was using andengine version GLES1 – Siddharth Jun 1 '12 at 5:48
• Then it should work. What error do you see? – JohnEye Jun 1 '12 at 11:47