Picking issues on OSX?

We’re occasionally having a weird problem when picking on Mac OSX. As we traverse our scene tree, we push names onto the picking stack. There should be at least two names on the stack for anything drawn. But occasionally the selection buffer reports one hit with no names in the hit record.

This doesn’t seem to have a problem using JOGL on Linux or Windows. By far, most of the code is the same as what is run by many people on Windows with our old Java OpenGL binding. (We’re adding JOGL support, not writing a new system using JOGL.) I’m fairly confident in our selection code, and I’m pretty sure only one thread is doing any of the rendering stuff.

Is anyone aware of picking issues on a Mac, either in JOGL or underlying code?

For now, I can treat it as if nothing was picked, but it will appear as a bug in that the user will click and nothing will be selected.

Sorry I can’t make a test case for this the way I did for the applet problem and the Swing problem. Maybe I could, but I don’t know what it would take. Ours is a very complex system, and there is a lot going on in the case where we see this problem.

thanks
andy

When we implemented picking functionality for Xith3D, we had a lot of issues with Linux, but this was not related to JOGL itself, but to DRI-accelerated drivers (in short words, picking polygons with CULL_NONE from back side did not work).

You can try Xith3D picking tests on MacOS (I think JWS versions available)…

Yuri

Is anyone aware of picking issues on a Mac, either in JOGL or underlying code?

When I tried to use the selection buffer on mac os x, my program started to produce random results and even crashed sometimes with segementation violations.

I found out, that the problems were much more likely, if many objects were allocated or garbace collected during the picking. My guess is, that the VM moves the location of the selection buffer in memory after it was registered with jogl. There is an issue filed in the bugtracking system, stating that an nio direct buffer should be used, but I can’t remember, where I found it.

Hi,

I’m seeing this problem on PC and Linux platforms as well, I’m getting crashes as well.

So I need to create a primitive int array which the garbage collector won’t shift or re-alloc?

I’ve tried creating a direct buffer using the

java.nio.ByteBuffer.allocateDirect() and then getting an IntBuffer calling its asIntBuffer() method. Unfortunately I can’t access the raw array to pass to glSelectBuffer!

Any other suggestions to overcome this problem?

Thanks

Alan

I do not really know, how to solve the problem using direct buffers. When I had the same problem, I had to created a pure java solution making all the necessary geometry calculations for hit checking myself.

I looked up the bug report:
https://jogl.dev.java.net/issues/show_bug.cgi?id=36

I suspect, that the C-Code quoted in the Bug report must be modified to extract the backing array of a direct buffer. glVertexPointer, which should run into the same problem, uses a Buffer as parameter. The code can probably adapted for glSelectBuffer.