PDA

View Full Version : OpenGL mouse -> geometric object?


IceColdDuke
05-29-2005, 03:45 PM
What would be the easiest way to calculate if you click on a geometric object in OpenGL(like a Level editor when you click on the face of a object)?

DudeMiester
05-29-2005, 04:50 PM
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=32

His Shadow
05-30-2005, 12:58 AM
Here is also one method... www.bookofhook.com (http://www.bookofhook.com/) (see Article on Mouse Picking).

If you got the time and patience, you could also implement "ray tracing", which will give you far more advanced editing capabilities.

IceColdDuke
05-31-2005, 08:52 PM
His Shadow said:
Here is also one method... www.bookofhook.com (http://www.bookofhook.com/) (see Article on Mouse Picking).

If you got the time and patience, you could also implement "ray tracing", which will give you far more advanced editing capabilities.



I would expect ray tracing isn't realtime(except on Geforce 6+ cards where its hardware rendered).

Thanks for the Nehe link it worked...: )

His Shadow
05-31-2005, 11:03 PM
IceColdDuke said:

His Shadow said:
Here is also one method... www.bookofhook.com (http://www.bookofhook.com/) (see Article on Mouse Picking).

If you got the time and patience, you could also implement "ray tracing", which will give you far more advanced editing capabilities.



I would expect ray tracing isn't realtime(except on Geforce 6+ cards where its hardware rendered).

Thanks for the Nehe link it worked...: )


Hehe.. what I meant was that you construct a ray from the mouse position and find the closest intersecting object (not realtime raytacing http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif ). This method you can use to select objects, or even faces on the object or vertices. But this method involves some work though (and math).

DudeMiester
06-02-2005, 01:17 PM
You'd do the ray tracing on the CPU, and you can easily trace hundreds of rays realtime (www.realstorm.de). In almost all games, all instant hit bullets are done with ray tracing, and it is used in many other ways in the physics engine. I know Doom 3 uses ray tracing to predict collisions in it's physics engine.