Look at GraphUI's SceneUIController.pickShapeImpl:
(in jogl's git repo)
This method utilizes com.jogamp.opengl.math.FloatUtil.mapWinToRay(float,
float, float, float, float, int, float, int, int, int, Ray, float,
In the git repo's history you will also find a previous method
to use false color rendering (color = object-id) to pick the object.
Hope it helps.
On 12/31/19 9:18 PM, vorth [via jogamp] wrote:
> First: you guys have my undying gratitude for your dedication to maintaining
> JOGL, etc. My app (https://vzome.com
) would have died many years ago without
> your hard work. Harvey has been particularly helpful, and he even showcased
> vZome as a Java3d app once, I think at SIGGRAPH.
> Now, I'm finally eliminating Java3d from vZome and using JOGL directly, and
> using it without the fixed function pipeline. So far, the results are very
> gratifying, and I haven't even looked at the memory profiling yet. All the
> easy stuff is done, but I have a few thorny tasks left. The biggest one is to
> implement picking.
> I've been digging around, looking for a reasonably straightforward sample. I
> found Julien's SO post
> which led me to this sample of Sven's
> which is perfect in size and scope, but it uses the deprecated OpenGL built-in
> picking, and the fixed-function pipeline.
> My hope is to modernize that sample; I have already forked java-demos. I was
> able to build and run the picking demo on my Mac, but it has a defect at the
> moment: the picking seems to be using the wrong coordinates, so that the
> results don't match the mouse location. QUESTION 1: Does anyone know if that
> demo works correctly on other platforms?
> QUESTION 2: Does anyone have or know of a good demo of picking using
> or really any modern demo of picking with JOGL?
> I hope to prove out picking in a sample, before I try to get it working in my
> more complicated application. I'll be happy to "give back" and submit a pull
> request, if I'm successful.