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 tried and it’s still the same. I also created a new project and I built , still the error is same.
Is there any alternate solution or any other library ?
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.
now when using the QVTKWidget, I cannot get the correct depth data from the function vtkOpenGLRenderWindow::GetZbufferData. What do I need to change to make it work again?
I found a work around to this issue by not using any of QVTKOpenGLNativeWidget/QVTKOpenGLStereoWidget/QVTKWidget. Instead, I just pass the QWidget.windId to the vtkWin32OpenGLRenderWindow as follows: