Hi,
I have a simple GUI with VTK+QT that would update the volume constantly. We use it to have 3D live volume rendering.
I am trying to do the same thing with a QtQuick GUI, I faced two issues:
1- The timer callback that I use for updating the Data, will not work until I move the cursor over the render window.
2- When I click on the render window, it crashes.
Here’s what I get in the output after it crashes:
Generic Warning: In …\VTK-9.1.0\Source\Rendering\OpenGL2\vtkOpenGLState.cxx, line 539
at stack loc
at vtksys::SystemInformation::GetProgramStack
at vtksys::SystemInformation::GetProgramStack
at vtkOpenGLState::vtkglDrawBuffer
at vtkOpenGLRenderWindow::BlitDisplayFramebuffersToHardware
at vtkOpenGLRenderWindow::Frame
at vtkGenericOpenGLRenderWindow::Frame
at vtkRenderWindow::Render
at vtkOpenGLRenderWindow::Render
at vtkGenericOpenGLRenderWindow::Render
at vtkRenderWindowInteractor::Render
at QQuickVTKRenderWindow::paint
at QMetaObject::activate
at QQuickWindowPrivate::renderSceneGraph
at QSGDefaultLayer::updateTexture
at QSGDefaultLayer::updateTexture
at QThread::start
at BaseThreadInitThunk
at RtlUserThreadStart
Part of the code the code with the callback, as I am suspecting what I do with vtkRenderWindowInteractor (iren) is not right probably for QML case:
m_QQuickvtkrenderItem->renderer()->AddVolume(volume);
m_QQuickvtkrenderItem->renderer()->SetBackground(0.10, 0.10, 0.10);
m_QQuickvtkrenderItem->renderer()->ResetCamera();
m_QQuickvtkrenderItem->update();
vtkSmartPointer<vtkTimerCallback> cb = vtkSmartPointer<vtkTimerCallback>::New();
iren = m_QQuickvtkrenderItem->renderer()->GetRenderWindow()->GetInteractor();
cb->IREN = iren;
cb->IMData = ImData;
cb->Height = height;
cb->Width = width;
cb->Depth = depth;
cb->Nframes = n_frames;
cb->Data = data;
iren->AddObserver(vtkCommand::TimerEvent, cb);
int timerId = iren->CreateRepeatingTimer(0.005);
Any help would be much appreciated.
Best,
Parisa