LWJGL Forum

Programming => OpenGL => Topic started by: djx on February 15, 2011, 18:32:42

Title: Detecting when 2d point is inside 3d shape?
Post by: djx on February 15, 2011, 18:32:42
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?
Title: Re: Detecting when 2d point is inside 3d shape?
Post by: Mickelukas on February 16, 2011, 09:07:51
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
Title: Re: Detecting when 2d point is inside 3d shape?
Post by: djx on February 17, 2011, 12:35:21
Thanks. I'll try to report back if/when I find anything interesting.