View Full Version : About ray casting and selection mode

10-29-2002, 04:24 AM
I wonder if direct software implementation of ray casting is faster, or using selection mode (which may be supported by hardware) is faster? Can anybody tell me? I really need an definite answer since this affect my project a lot.

Thank you !

10-29-2002, 04:54 AM
There is no definite answer. It depends on your platform setup, your code, the complexity of the scene, and other things. The best answer you can get is to try both ways and see what's best in your case. You may even get different result on different platforms with the same code and the same scene.

10-29-2002, 05:48 AM
selection mode is never hw on a pc. dunno about sgi workstations, or such, but on a pc, never.. (never meaning never by a 99% chance http://www.opengl.org/discussion_boards/ubb/biggrin.gif)

10-29-2002, 06:07 AM
Reaycasting test is very different than the OGL select mode test !

To do exactly what is doing OGL, you must process primitives in a classic pipeline from transform to clipping : at clipping, if the entire primitive is hiden, then she's not flaged as selected in the select buffer. Raycasting is testing only a ray, OGL select mode is testing a view frustum...



10-29-2002, 04:28 PM
Thank you. In my case I need to detect if a "gun bullet" hits some objects in the scene, and I think both ways can do this (using ray casting or selection mode).

My platform is VC++ .NET, Win XP, GeForce2. I will try ray casting later. Thank you very much !!

10-29-2002, 04:44 PM
You absolutely have to build your own hit testing and geometry processing code.

Search the web for the libraries "OPCODE," "MAGIC" or "RAPID" for examples.

Treat OpenGL as a black box, where you pour in state and vertex data on one end, and receive pixels out on the display connected to the other end. If you do anything else, be prepared for OpenGL to let you down.