Vtk9.x Cannot used in QQuickFramebufferObject::Renderer *createRenderer() but vtk8.x can do .

See below project :

nicanor-romero/QtVtk: An integration between Qt Quick Controls 2 and VTK for 3D rendering (github.com)


qCring/QuickVtk: A VTK prototyping application based on QtQuick/QML (github.com)

They are use qt createRenderer() and createFramebufferObject() to create Vtk in qml. And this method is avaliable in Vtk 8.2 , but can not use in version after vtk 9.1.

No errors , but this have no picture .

After use official method of using vtk with qml suck like qquickVtkRenderWindow and other method such like qt::createRenderer() , I think use qt::createRenderer() is the best way to use vtk in qml . but after 9.x , this method can not used anymore ,

Cc: @sankhesh

If you need some source code I changed for building , I will upload them.

@edwardAllen, It might be related to differences in how the OpenGL context is set up in Qt and VTK.
Hard to say without actually looking into it. Since you had it working at some point, you could use git bisect to figure out the change that broke it.

I had see the different between vtk 9.2 and vtk 8.2 , and I had changed some thing to make program running , but it show nothing , and I cannot figure out where the bug is . Here are a demo by using this method , hope you can see it .
testViewerWithFrameBuffer.zip (37.6 KB)

I had checkout many method to use vtk with qml , but after update vtk to 9.x , official give a qquickVtkRenderWindow dem it have many bugs when use it with qml , and if I back to use method
useful in vtk 8.2 , that method qt::createRenderer() not working with 9.x , so , until 9.2 , here are still not have a suitable method, I think qt::createRenderer() maybe a good method. , but I cannot fix the issue show nothing…


We did some work on a project in mid 2021 that had tried to fix a lot of these issues. Not sure if we ever put in a PR for it or not. Those commits have some of that work. We got a lot of VTK working nicely with QML. Ultimately we ended up dumping QML for other reasons and went back to widgets.

I think we were mainly editing the example code to get VTK working with QML. You can take a look at that code and see if any of it is still relevant.