Looking at the debug drawing code from the TestBed, I'm a bit confused as to how the drawing of the bodies and shapes is done. From what I understand, there is a flag that you set that turns on debug drawing, and it is done whenever b2World::Step is called.
But then I find that the b2DebugDraw class is defined inside the b2WorldCallbacks.h...
Now most of the programming I've done in the past is Java and I've never had formal C/C++ training, so I don't really understand the concept of a callback.
Are there any significant disadvantages in using a more straightforward approach to render my simulated Box2D objects (keeping track of them separately, looping through them, etc)?
I eventually will separate the physics simulation from the graphics framerate, so from what I understand I will definitely need to do this at that point, too.
Edit: Alright so it works pretty well if I just use b2World::GetBodyList(). I'll stick with that.
But then I find that the b2DebugDraw class is defined inside the b2WorldCallbacks.h...
Now most of the programming I've done in the past is Java and I've never had formal C/C++ training, so I don't really understand the concept of a callback.
Are there any significant disadvantages in using a more straightforward approach to render my simulated Box2D objects (keeping track of them separately, looping through them, etc)?
I eventually will separate the physics simulation from the graphics framerate, so from what I understand I will definitely need to do this at that point, too.
Edit: Alright so it works pretty well if I just use b2World::GetBodyList(). I'll stick with that.