I am using Qt 5.15.0 framework and my VTK version is 9.0.
I am new to VTK and I am working on reading the DICOM image application in Qt framework using VTK. The application is showing the DICOM image in a separate window, but I want the DICOM image to be executed in the MainWindow.
I have encountered the same problem. I had an old code using obsolete QVTKWidget that could not compile with VTK 9 until I replaced QVTKWidget with QVTKOpenGLNativeWidget. The runtime error was caused by passing an instance of vtkRenderWindow as a parameter of SetRenderWindow method. I guess that years ago QVTWidget did not create RenderWindow automatically and that was the solution. Unfortunately, vtkRenderWindow is in fact vtkWin32OpenGLRenderWindow, which is not supported in QVTKOpenGLNativeWidget. My solution: simply remove the line with SetRenderWindow.
@mwestphal I have another issue when switching from vtk8 to vtk9. The rendering time is roughly 5 times slower than vtk8. I think it’s because of using the vtkGenericOpenGLRenderWindow instead of vtkWin32OpenGLRenderWindow. What a pity that I cannot use vtkWin32OpenGLRenderWindow anymore. Also vtkWin32OpenGLRenderWindow has some advantage of reusing the opengl shared context. My biggest problem now is the poor rendering time. Is there anything else affecting the performance between vtk8 and vtk9?
my application has a lot of QVTKOpenGLNativeWidget/vtkGenericOpenGLRenderWindow let’s say 18 instances. when I reduce the number of QVTKOpenGLNativeWidget to 4 it is getting better but way more slower than the version using vtk8. What’s your opinion?
I have tested vtk9 with QVTKWidget (recovered from the commit: “Removing QVTKWidget and all related classes”
f55f45faced3ddd37d30ef811558b009ae6d6746) and it’s as fast as the vtk8, please see the following link:
However, with if I use QVTKOpenGLNativeWidget, it will be very laggy as shown in the video link below:
I suspect it has something to do with the new QOpenGLWidget concept. It would be nice if you could confirm and maybe have some idea to improve the rendering performance of QVTKOpenGLNativeWidget. Otherwise I have to use the QVTKWidget in my own forked branch. Which is hard to maintain and not optimal. Many thanks.