Author
Topic: PickPolygon reporting nothing (Read 7493 times)

In the render loop, I try it just after the scene is rendered/drawn/displayed to framebuffer. It works!

Still inside render loop, but before rendering, I very rarely get anything from it.

I do use multiple cameras, and multiple framebuffers.I am certain it is because of this.I have tried setting the world to the active camera, and even rendering the scene again, before pickPolygon, but no luck:)

You need a valid VisLIst for using pickPolygon, i.e. one that represents the currently visible frame. If you do the picking in thread a and the drawing (i.e. the implicit creation of the VisList) in thread b (aka in paintComponent), you'll get random results depending on the current state of the VisList, which can be anything between empty and full. Could that be the problem here?

VisList-management got so complicated, that giving this method back its real purpose is pointless. I'll remove it from the next version.You are right...my idea won't work, because storing the VisList doesn't prevent it from being updated by another thread. The only solution i can think of is to do the picking right after the renderScene in the same thread, i.e. in the paintComponent(). Or are you already doing this? It's still not clear to me, which thread does what in your application and which one calls the getObjectAtCursor()-method!?