Display Lists And Collisions
Question submitted by (01 November 1999)




Return to The Archives
 
  I am a 3D game programmer who has just begun to use the OpenGL API. I am having difficulty determining the best (or industry standard) system to support collision detection while still wringing the most out of OpenGL's rendering capabilities. For example, I would like to use display lists, which seem particularly attractive for animations. However, to determine whether an object strikes a particular part of the terrain or enclosure, I need to know the actual coordinates of the walls and object, which OpenGL will not provide. However, to use display lists, I will need to use OpenGL matrix facilities. This appears to be a common frustration.

I have implemented my own matrix routines similar to those of OpenGL and transformed my model coordinates to camera coordinates, then checked for collisions. This came at the cost of a visible performance decrease. The only other alternative I see is not to transform all of my model coordinates, but just the location and orientation of my model and let OpenGL do the rest. This way I know where OpenGL is putting my models, but maintaining two sets of transformations seems inconsistent, clumsy and error-prone. I have not yet found any information on the industry-standard method of dealing with what seems a fundamental issue - maybe because each system must be tailored to a specific game.
 
 

 
  The industry standard method (if there is such a thing) is to use your own matrices for collision detection and allow OpenGL to perform all the transformations to view space. You seem to imply that you are doing your collisions in camera space, and this isn't typical so I'm not sure exactly what you're trying to do here. Usually collisions are done in world space and using simplified versions of the objects (spheres or boxes) so doing collision detection and rendering as two separate code paths is normal.

This is not to say that all applications allow OpenGL to do the transformations. I believe Unreal and Unreal Tournament do their own transforms and pass geometry to OpenGL in screen space. Of course that also means they are totally missing out on geometry acceleration on cards like he GeForce256 and the Savage2000.

As far as using display lists goes, they're fantastic for static objects but if the object is animated you're better off using vertex arrays.



Response provided by Tom Hubina
 
 

This article was originally an entry in flipCode's Fountain of Knowledge, an open Question and Answer column that no longer exists.


 

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.