Ray picking using FloatUtil makePick

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Ray picking using FloatUtil makePick

ericg
Hello,  I am trying to implement ray picking in my application (using GL4 and GLSL4) and I was wondering if the makePick function on FloatUtil would be useful for this?  Previously I have used gluUnProject to create the pick vector and that worked great.  Now, however, I no longer have access to GL_MODELVIEW_MATRIX or GL_PROJECTION_MATRIX as none of those concepts were retained I think as of 3.x?

Anyway, would makePick be worth looking at?  Are there examples of its implementation out there anywhere?
Reply | Threaded
Open this post in threaded view
|

Re: Ray picking using FloatUtil makePick

Sven Gothel
Administrator
On 11/08/2014 04:50 AM, ericg [via jogamp] wrote:
> Hello,  I am trying to implement ray picking in my application (using GL4 and
> GLSL4) and I was wondering if the makePick function on FloatUtil would be
> useful for this?  Previously I have used gluUnProject to create the pick
> vector and that worked great.  Now, however, I no longer have access to
> GL_MODELVIEW_MATRIX or GL_PROJECTION_MATRIX as none of those concepts were
> retained I think as of 3.x?

Even though the fixed function pipeline matrix set is not available
to core GL profiles, it surely is still important for implementations.

Difference here is, that for core profiles the user has to implement its own,
see <https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/util/PMVMatrix.html>.

>
> Anyway, would makePick be worth looking at?  Are there examples of its
> implementation out there anywhere?

FloatUtil already has one method extracting a ray via a 'unproject' operation:

<https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/math/FloatUtil.html#mapWinToRay%28float,%20float,%20float,%20float,%20float[],%20int,%20float[],%20int,%20int[],%20int,%20com.jogamp.opengl.math.Ray,%20float[],%20float[],%20float[]%29>

.. which is also exposed via our PMVMatrix class:

<https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/util/PMVMatrix.html#gluUnProjectRay%28float,%20float,%20float,%20float,%20int[],%20int,%20com.jogamp.opengl.math.Ray%29>

A simple ray intersection w/ a AABBox is also available, see API doc:

<https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/math/Ray.html>

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Ray picking using FloatUtil makePick

ericg
Ok thanks, I'm sure I can tease out the model/view matrices on my own and reuse unProject.  Thanks for the links!