4

I have a working project on Qt using pcl and vtk....I was using QVTKWidget.

Now I need to re-build the project using QVTKOpenGLWidget as QVTKWidget is deprecated

This post suggests that the latest PCL version from master should be used QVTKOpenGLWidget and vtkGenericOpenGlRenderWindow with QTDesigner

I did that and changed the necessary files but when compiling the project always crashes when I link pclVisuiliser with QVTKOpenGLWidget.

QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());

QApplication app(argc, argv);

QVTKOpenGLWidget *widget = new QVTKOpenGLWidget();

vtkNew<vtkRenderer> renderer;
vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer.Get());

pcl::visualization::PCLVisualizer::Ptr pclViewer(new pcl::visualization::PCLVisualizer(renderer.Get(), renderWindow.Get(), "viewer", false));
widget->SetRenderWindow(pclViewer->getRenderWindow());

widget->show();

When these two lines are commented out the project doesn't crash :

pcl::visualization::PCLVisualizer::Ptr pclViewer(new pcl::visualization::PCLVisualizer(renderer.Get(), renderWindow.Get(), "viewer", false));
widget->SetRenderWindow(pclViewer->getRenderWindow());

I'm using Qt 5.9.5 and latest version from master on github for PCl and VTK.

Is there anything missing ?

3
  • Is this code part of the main() function of your application? Commented May 10, 2018 at 16:00
  • For your information, a new QVTKOpenGLWidget is coming. gitlab.kitware.com/vtk/vtk/merge_requests/3745 Commented May 23, 2018 at 12:24
  • One year later and still waiting for this merge. The old one that is deprecated and the new one that crashes... that's maddening. Commented May 8, 2019 at 12:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.