Thank you again for your response.
- Show quoted text -
On Tue, Apr 13, 2010 at 11:20 AM, Greg Ewing <firstname.lastname@example.org>
You're quite right, I was misremembering, sorry.
Eleftherios Garyfallidis wrote:
> to get
the near plane I believe you need to gluUnProject with z=0. and to get the far plane you need to gluUnProject with z=1
That sounds like there is something wrong with your matrices.
Surprisingly, when I do glu.gluUnProject(x,viewport-y,0.) and glu.gluUnProject(x,viewport-y,1.)
in PyOpenGL it seems it works fine but when I am feeding the
transformation matrices by myself I am getting this error "Projection
How are you getting them? Are you getting them directly from
OpenGL, or calculating them yourself? If you're calculating them
yourself, you might be making a mistake somewhere.
What happens if you retrieve the relevant matrices from OpenGL
and feed them to gluUnProject? If that works, compare them with
your own matrices to see if there is a difference.
Yes this is what I am doing just calculating these matrices using the following PyOpenGL functions
import OpenGL.GL as gl
These matrices are numpy arrays do you think that it might be a problem
when we put these as input in gluUnProject? Should I transform them
into something else perhaps?
By the way I do confirm that when using gluUnProject without
feeding in the transformation matrices as in
-y,0.) does work correctly :-) I
made some tests with picking planes and the accuracy of picking was
excellent!!! The tests involved checking if the segment AB (where A is
near and B is far) intersects with planes. For my application I need to
check against many planes so I made a function for this in cython. The
link for the code is here