Hi,
We are using vtkOPenGLHardwareSelector as a base class for our own hardware cell picker. (While it seems like there are some hardware-accelerated prop pickers, we don’t see a hardware cell picker, so we wrote our own). In general, it works great but there is one big problem. If we don’t build a separate renderer for the picking and copy all of our props into it, it doesn’t always pick correctly and sometimes we get openGL state errors.
The basic process that we follow is this:
- call BeginSelection()
- call SetArea(…) with the area we want to pick
- call SetFieldAssociation(vtkDataObject::FIELD_ASSOCIATION_CELLS);
- call renderwindow->OffScreenRenderingOn();
- call CaptureBuffers()
- Process captured data
- call ClearBuffers()
- call renderwindow->OffScreenRenderingOff();
- call EndSelection()
If we build a new renderer and add it to the render window and use it for this work, everything works great. If we use the existing renderer, it does not always pick correctly, sometimes objects disappear from the screen, sometimes the screen goes black. Definitely something in OpenGL seems not happy. Once it goes wrong, the display is never correct again.
We would rather use the same renderer that we are using to display things on the screen as it takes too much time to build the new renderer and this is occurring during user interaction. Does anyone have any idea why we need to create a new renderer for this to work correctly? Is there some way to reset the renderer after doing a capture?