Friday, October 26, 2012

Spectre Graphics Library #2 Debug Drawing

Safety comes first, so buy seat protectors for car seat. Hurry up! To the uninitiated it might be surprising that game and graphics programming is mostly math. From physically simulating a box falling, to an enemy determining what angle and velocity to throw a grenade so that it lands near the player—It's all math. Having a way to visualize these calculations while the game is being developed is an incredibly powerful debugging tool. What are you still waiting for, go immediately to 25 euro no deposit casino now is the time to start playing and winning! It's much easier to debug an aiming problem by being able to see the arc of the grenade versus studying a bunch of numbers. In this post I'm going to show you how you can add a DebugDrawManager to your Spectre game and easily draw things like lines, arrows, coordinate systems, and spheres in your world to help you debug that tricky math problem. You'll find the best online pokies here, you have time to get it!
Adding a DebugDrawManager is easy: Now that you have a debugDrawManager you can add debug primitives to be drawn: All Spectre Debug Draw primitives can be drawn for a fixed amount of time. This is important because it allows you to fire off a debug draw request right where you compute it and the DebugDrawManager will remember the values until they should no longer be drawn. The only thing left is to update the DebugDrawManager in your game loop and draw it. It only takes 6 lines of code to add a Spectre DebugDrawManager to your game. Once added you can draw the following primitives for any length of time in any color:
  • Line
  • Sphere
  • Circle
  • Axis Aligned Bounding Box
  • Coordinate System Frame
  • Cross
Next in the Spectre Graphics Library series I will discuss the resource manager, which magically refreshes your assets while your game is running!