Hi
I was hoping to use vtkFinitePlaneWidget in my application but getting the error below.
I think I found what is the issue but not sure how to solve it.
To display mouse coordinates in my application, I’m tracking the position of the mouse using the
function
int pos = Interactor.GetEventPosition();
which creates the error below.
As long as I comment this line in the code everything work fine.
Note: I’m using the Activiz version 9.2.2023.328. Other widgets such us vtkImplicitPlaneWidget2 or vtkBoxWidget2 don’t produce any errors
vtkWin32OpenGLRenderWin:267 ERR| vtkWin32OpenGLRenderWindow (000000001F00FB80): wglMakeCurrent failed in MakeCurrent()
I don’t think the problem is directly related to the call to GetEventPosition, as it is just an accessor that returns an int array, whereas the issue you report shows that the OpenGL context was lost.
If you could share a small example to reproduce the problem, I’ll be happy to investigate quickly.
Removing UpdateCoordinates of GetPickedPosition has no direct impact on the bug on my side. I mainly reproduce when resizing the window continuously only if addPlaneWIdget(); was called.
Then the stack trace helps, as it shows that the exception happens when deleting the finite plane widget:
at Kitware.VTK.vtkObjectBase.vtkObjectBase_UnRegister_19(HandleRef pThis, HandleRef o)
at Kitware.VTK.vtkObjectBase.Dispose(Boolean disposing)
at Kitware.VTK.vtkFinitePlaneWidget.Dispose(Boolean disposing)
at Kitware.mummy.Runtime.WrappedObject.Finalize()
Some VTK widgets representation need the render window to free their graphics resources in the OpenGL context, which does not seem to be current when the GC collects the plane widget.
Storing the finite plane widget instance in your class, the same way you did for the orientation marker widget is the best way to go for now. It fixes the issue on my side.