Hi everyone,
I'm moving to Box2d from Chipmunk and I'm having trouble understanding the whole "meters, not pixels" thing.
To complicate it (a bit) further, I'm not using opengl but Indielib, a game engine that uses DirectX.
I've implemented the DebugDraw class successfuly, but I do not understand how the testbed implements the "zoom" functionality.
Let's say I have a box 1mx1m, and I want to render it on the screen where 1m=100 pixels. How do I go about doing that? I see that the testbed has a ConvertScreenToWorld method - how does that come into play?
The code is not well documented and it's hard for someone with no openGl experience to follow through...
I've also read somewhere that the easiest thing to do is set a global transform with your scaling ratio. That makes sense if you're just drawing lines and boxes, but it wouldn't work if I'm rendering sprites (everything will be stretched horribly).
So I guess I need a primer on how to deal with meters->pixels conversion, and also where that should happen and how I can make it work for sprites as well as primitives.
Thanks!
I'm moving to Box2d from Chipmunk and I'm having trouble understanding the whole "meters, not pixels" thing.
To complicate it (a bit) further, I'm not using opengl but Indielib, a game engine that uses DirectX.
I've implemented the DebugDraw class successfuly, but I do not understand how the testbed implements the "zoom" functionality.
Let's say I have a box 1mx1m, and I want to render it on the screen where 1m=100 pixels. How do I go about doing that? I see that the testbed has a ConvertScreenToWorld method - how does that come into play?
The code is not well documented and it's hard for someone with no openGl experience to follow through...
I've also read somewhere that the easiest thing to do is set a global transform with your scaling ratio. That makes sense if you're just drawing lines and boxes, but it wouldn't work if I'm rendering sprites (everything will be stretched horribly).
So I guess I need a primer on how to deal with meters->pixels conversion, and also where that should happen and how I can make it work for sprites as well as primitives.
Thanks!