Detecting when 2d point is inside 3d shape?

Started by djx, February 15, 2011, 18:32:42

Previous topic - Next topic

djx

Hi,
I've been using gluLookAt to move the camera around (which works fine), but what I want is to know if I'm looking at something.
In other words, if a 2d point on my screen (like a crosshair or mouse pointer) is inside a 3d shape.

I think I need to get the 2d coordinates that correspond to the 3d position, however, this doesn't solve the issue of what to do if the shape is covered up by a different one (I don't want that to count).

Does anyone know how I can accomplish this?

Mickelukas

Google "OpenGL picking tutorial" and you'll get some examples. It's quite complex though in my opinion, especially when combining it with for example VBO's.

Mike

djx

Thanks. I'll try to report back if/when I find anything interesting.