vtkInteractorStyles that draw selected area fail with QQuickVtkItem

I use vtkInteractorStyleRubberBandPick with QQuickVtkItem with VTK 9.3 in my C++ application that uses Qt and VTK. However when I drag the left mouse button, a selection area is not drawn but many warning/error messages are written to stderr. The same occurs when I use any vtkInteractorStyle that attempts to draw a selected area, such as vtkInteractorStyleDrawPolygon. These warning/error messages are generated when I begin left mouse button drag:

ESC[0mESC[33m2025-07-08 15:00:17.362 ( 28.565s) [ 7F8182151640] vtkOpenGLState.cxx:57 WARN| Error in cache state for GL_DEPTH_WRITEMASKESC[0m

ESC[0mESC[33m2025-07-08 15:00:17.362 ( 28.565s) [ 7F8182151640] vtkOpenGLState.cxx:133 WARN| Error in cache state for GL_VIEWPORTESC[0m

ESC[0mESC[33m2025-07-08 15:00:17.368 ( 28.570s) [ 7F8182151640] vtkOpenGLState.cxx:263 WARN| at stack loc

0x7f86cda15ba1 : ??? [(???) ???:-1]

0x7f86cda101db : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.3.so.1) ???:-1]

0x7f86c690333f : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.3.so.1) ???:-1]

0x7f86c6905061 : vtkOpenGLState::vtkglBindFramebuffer(unsigned int, unsigned int) [(libvtkRenderingOpenGL2-9.3.so.1) ???:-1]

0x7f86c690501d : vtkOpenGLState::vtkBindFramebuffer(unsigned int, vtkOpenGLFramebufferObject*) [(libvtkRenderingOpenGL2-9.3.so.1) ???:-1]

0x7f86c68026b0 : vtkOpenGLFramebufferObject::Bind(unsigned int) [(libvtkRenderingOpenGL2-9.3.so.1) ???:-1]

0x7f86c68d084a : vtkOpenGLRenderWindow::SetRGBACharPixelData(int, int, int, int, unsigned char*, int, int, int) [(libvtkRenderingOpenGL2-9.3.so.1) ???:-1]

0x7f86c67b5318 : vtkGenericOpenGLRenderWindow::SetRGBACharPixelData(int, int, int, int, unsigned char*, int, int, int) [(libvtkRenderingOpenGL2-9.3.so.1) ???:-1]

0x7f86ca42d075 : vtkInteractorStyleRubberBandPick::RedrawRubberBand() [(libvtkInteractionStyle-9.3.so.1) ???:-1]

0x7f86ca42c9c6 : vtkInteractorStyleRubberBandPick::OnMouseMove() [(libvtkInteractionStyle-9.3.so.1) ???:-1]

0x7f86c94b54b7 : vtkInteractorStyle::ProcessEvents(vtkObject*, unsigned long, void*, void*) [(libvtkRenderingCore-9.3.so.1) ???:-1]

0x7f86cf20f0cb : vtkCallbackCommand::Execute(vtkObject*, unsigned long, void*) [(libvtkCommonCore-9.3.so.1) ???:-1]

0x7f86cf3ef5f2 : ??? [(???) ???:-1]

0x7f86cf3efbe9 : vtkObject::InvokeEvent(unsigned long, void*) [(libvtkCommonCore-9.3.so.1) ???:-1]

0x7f86cb519b86 : QVTKInteractorAdapter::ProcessEvent(QEvent*, vtkRenderWindowInteractor*) [(libvtkGUISupportQt-9.3.so.1) ???:-1]

0x7f86d0211263 : ??? [(???) ???:-1]

0x7f86d02119c9 : ??? [(???) ???:-1]

0x7f86d021185a : ??? [(???) ???:-1]

0x7f86d0211707 : ??? [(???) ???:-1]

0x7f86d0213961 : ??? [(???) ???:-1]

0x7f86d0210d07 : QQuickVTKItem::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) [(libvtkGUISupportQtQuick-9.3.so.1) ???:-1]

0x7f86cc3748b8 : QQuickWindowPrivate::updateDirtyNode(QQuickItem*) [(libQt6Quick.so.6) ???:-1]

0x7f86cc375234 : QQuickWindowPrivate::updateDirtyNodes() [(libQt6Quick.so.6) ???:-1]

0x7f86cc37925e : QQuickWindowPrivate::syncSceneGraph() [(libQt6Quick.so.6) ???:-1]

0x7f86cc589bdc : ??? [(???) ???:-1]

0x7f86cc58b114 : ??? [(???) ???:-1]

0x7f86cc58c3a7 : ??? [(???) ???:-1]

0x7f86ccb76ef8 : ??? [(???) ???:-1]

0x7f86cb680ac3 : ??? [(???) ???:-1]

0x7f86cb712850 : ??? [(???) ???:-1]

My code works properly when I use a vtkInteractorStyle that does not attempt to select an area, such as vtkInteractorStyleTrackballCamera, vtkInteractorStyleFlight, vtkInteractorStyleTerrain.

Seemingly most relevant part of my code:

  pipeline->interactorStyle_->SetDefaultRenderer(pipeline->renderer_);

  pipeline->qVtkInteractor_->SetPicker(pipeline->areaPicker_);
  pipeline->qVtkInteractor_->SetInteractorStyle(pipeline->interactorStyle_);
  pipeline->qVtkInteractor_->SetRenderWindow(renderWindow_);

where interactorStyle_ points to vtkInteractorStyle. E.g. it can point to vtkInteractorStyleTrackballCamera - which works - or vtkInteractorStyleDrawPolygon - which fails as described above.

What might be causing this behavior and how to fix it? Is this an issue with QVtkInteractor, QQuickVtkItem, or both?
Thanks!

Has no one encountered this issue before?
Also I note that QQuickVtkItem exits with an error message if handed a vtkRenderWindowInteractor that is not a QVtkInteractor.

Hi @Tomasso, my guess is you’re running into threading issues. QtQuick uses a threaded scenegraph with a main thread and a separate render thread. VTK draw calls should just be made on the render thread. This is why QQuickVTKItem exposes a dispatch_async method to “schedule” tasks on the render thread. The interactor styles you mentioned aren’t aware of this and likely try to make render calls on the main thread. You’d have to subclass the style and use dispatch_async wherever it makes direct Render calls.

1 Like