I always have to have a nice little debug drawer class, something that can render lines, spheres etc. as simply as possible, for physics and game play on screen debugging.

As its something useful I’d thought i’d release my version to the public as its just a neat little tool to have in your arsenal and quite frankly there not great fun to get working.

Its worth nothing, this is not meant to be fast, clean or comprehensive… its just something that draw lines and simple objects without having to worry bout the real graphics stuff that goes on under the hood.

Its also will need a bit of modifying for use, I have a IEffectGlobals interface which I retrieve and get global matrices from (among other things), you will have to replace these lines with something that gets the appropriate matrix. PixelToTexels can be set to (0,0) if you don’t want to bother or follow the link in the shader to Simon Browns article about the correct value to stick in here (on PC only probably…)

Anyway its public domain, so feel free to use if your wanting something like this. Feel free to ask questions or if you’d like a working cleaned up version cos with a little bit of work I could make this a out of the box debug renderer just not sure if its worth the effort.

Does NDC Lines (screen space -1 to 1), World Lines, World Spheres, World Boxes and World Cylinders. Everything if buffered so you add debug renderer wherever and when ever you like without having to think of the current render state.

IDebugRenderer.zip