About ray casting and selection mode

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 !

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.

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 )

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…



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 !!

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.