Hi all.
I’m learning qt and vtk recently.
According to the tutorial in vtk examples, I successfully used vtkGenericOpenGLRenderWindow to draw vtk in qt.
Now I want to add MouseEvents. According to the MouseEvents in vtk examples, I need to use
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
renderWindow->SetWindowName("MouseEvents");
vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
renderWindowInteractor->SetRenderWindow(renderWindow);
vtkNew<customMouseInteractorStyle> style;
renderWindowInteractor->SetInteractorStyle(style);
This works fine in vtkRenderWindow,
but when I use vtkGenericOpenGLRenderWindow I get a black screen.
Mouse events still fire normally.
All I changed was replacing vtkRenderWindow with vtkGenericOpenGLRenderWindow in order to render into a Qtwidget.