PDA

View Full Version : Displaying 3d images with console output



dpanther1017
07-14-2006, 02:40 PM
I have a collision detection program that works well in C++, but its all numeric. I want to be able to see the collision and how the objects are interacting. I essentially place two objects in a random space and see if they share points. How can I use OpenGl to view the objects and see how they are overlapping. I also need to be able to output to the console window to see how many points are ovelapping. Both of the objects are created by storing points that make up triangels into classes. Any help is much appreciated.

plasmonster
07-26-2006, 10:15 AM
You could draw the objects with blending enabled and no depth testing (so neither object will be occluded). Something like some alpha blending might be nice, but experiment with the glBlendFunc parameters to get flavor you like. The idea is that you'll at least see a difference in (solid) color where the objects intersect.

Another possibility is to render both objects as opaque solids, with depth writing and depth testing enabled, then render the objects again using lines (or use glPolygonMode with GL_LINE) and no depth testing. This way you'll see the difference between the lines and the solids (if any). This is the approach taken by the Quake Radiant editor, so you can see the intersection of the selected brush with the world (very handy when placing things).

If your collision code generates contact points, nothing beats big red/yellow points in space for visualization.

Perhaps a combination of all the above, or maybe something cooler I haven't thought of (yet :-)).

For displaying (contact) information on the screen, a simple text overlay is awfully helpful, and may be preferable to a wintry digit blizzard in the console.