Fix for freeze with Java JOGL interaction
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
I seem to have found a solution to the problem with JOGL referenced in this conversation: http://www.vtk.org/pipermail/vtkusers/2014-May/084032.html
To recap, the following doesn't work and freezes on Windows:
- Screen capture (Using VTK code)
- Rubber band type of interaction where a rectangle get drawn on top of window.
- Volume rendering
Upon starting a rubber band interaction, vtk goes into an infinite loop in GetPixelData when clearing the OpenGL errors. This, I think, is a red herring. Basically, OpenGL gets into a bad state somehow.
The fix seems to be to force the context to be current in the java code. In vtkAbstractJoglComponent.java, the fix is to not check if the context is current, but instead always make it current (i.e., the if statement is commented out, forcing the makeCurrent() statement):
// Make sure the JOGL Context is current
GLContext ctx = drawable.getContext();
//if (!ctx.isCurrent()) {
ctx.makeCurrent();
//}
I've only tested this on Windows using a vtkInteractorStyleRubberBandZoom with VTK 6.1 and 7.0. It likely fixes the other issues and platforms, but someone else will need to test those.