View Full Version : gluProject behind me

02-23-2003, 10:40 PM

I use gluProject to figure out the screen coordinates of a certain point in space. This works fine except that I can't seem to find a way to see if that point is behind me or in front of me with gluProject. Is there a trick for this or am I going to have to manually transform this point using the OpenGL matrices and read its final z-value ?

02-24-2003, 02:09 AM
I haven't used gluProject but I'd imagine that if you try to transform a point that's behind you it'd return false. In fact I'd expect it'll do the same for any point that is not in the view Frustum.

What you need to do is transform the point into view space (or the view into object space) and then work out whether the point is on the view normal side or the "back" side.

02-24-2003, 03:51 AM
Nope, not getting a false.... winz value is always or very close to 1.0. Guess I'll be transforming that point manually then :}

02-26-2003, 06:44 AM
If you have frustum culling in your app, whyncha try running the point thru your near plane on your frustum?