Game Development Community

Help with debugging world space

by Michael Bacon · in Torque Game Engine · 09/12/2007 (5:50 am) · 2 replies

Are there any easy methods to draw lines in the world?

I've tried to use the gl commands but I think I have to setup things a bit and I'm not sure how or if I'm even calling these commands from the right location.

I'd like something as simple as (from anywhere in my code) drawLine(worldStartPos, worldEndPos, color). Given that I'll add a stack with a duration for each line to last.

I'm trying to debug my camera code and I'd really like to be able to see the rays it is casting as well as other points of interest (look at offset for one).

A bare-bones example of the proper way to use the gl commands to draw lines using world coordinates would suffice.

Also, do these gl commands need to be in a renderImage call or can I place them pretty much anywhere (i.e. processTick where most of my calculations are done).

#1
09/14/2007 (3:21 pm)
Nobody knows how to draw a line?

Okay, so maybe my question is a little too open...

How about this.

I tried to add a RenderImage function to my camera and draw the lines from there but the renderImage function never gets called.

Should I try to get it to work this way or should I create an entirely new object that keeps track of and renders all my debug data?
#2
09/14/2007 (3:29 pm)
When drawing, in world space, with OpenGL, the ModelView matrix should be set to the world->camera transform, and projection can stay the same (camera->screen). Normally ModelView is object->world * world->camera.