Page 1 of 1

Methods of rendering box2d objects

Posted: Sun Aug 28, 2016 11:30 pm
by fredells
Hello,

I am looking for a simple way to render box2d objects. What I want is simple outline and fill colors. Is it possible to control debug rendered output?

Alternatively is it possible to fill the objects with a repeating texture? Do I have to create shapes from the fixtures, color them, and then attach them to the bodies?

I am a bit lost on how to render anything without attaching images in RUBE :s

Thanks for any help,

Fred

Re: Methods of rendering box2d objects

Posted: Mon Aug 29, 2016 7:47 am
by iforce2d
This is not really a Box2D question since methods of rendering will depend on the platform, rendering API, game framework if you're using one, device type etc etc

For simple outline and fill colors, you could copy the debug draw functions and add color parameter(s) so you can set the color of each shape individually.

Filling shapes with a repeated texture is of course possible, but not quite so simple. If you can draw a polygon, then your rendering API should have a method for generating texture coordinates. This is where you need to read the docs for whatever API you're using :)