Is it possible to visualize the point cloud in QVTKOpenGLWidget?

I can’t see any client code in your stack, only a rather complex sequence of library calls triggered by user events. It seems to me that some of the dependencies is not compatible with the others or need upgrade.

Basic checklist:

  1. Make sure you have the latest version of the graphics card driver, which includes OpenGL backend libraries.
  2. Make sure the triad Qt 5.9.5 X PCL 1.12.1 X VTK 8.2.0 is mutually compatible.
  3. Ubuntu 18.04 is somewhat old. Have you kept it updated with the latest patches, fixes, etc?
  4. Is it possible to try Qt 5.12.5 or later?

If these don’t solve it, then I’d recommend reducing the program until you have a working code (e.g. try removing PCL and point cloud) then add complexity bit-by-bit until you get the crash. This will help you pinpoint the cause of problem.

2 Likes

@Paulo_Carvalho Sorry for my late reply. Thank you for your suggestions and kindness. Finally, the program just runs without crash after some modification in .cxx files of VTK. But, There is another problem. :grin:
When I load the “bunny.pcd” file, it can be displayed in QVTKOpenGLWidget without crash.However,I can’t scroll(zoom in/out) or rotate the camera angle when the point clouds are displayed in real time. It’s just been displayed at a fixed camera angle and, neither be rotated nor scrolled. I just use while loop and UpdatePointCloud to display. Is there anything that I’ve missed out??

while(!stop_bool)
{
pcl_viewer->updatePointCloud<pcl::PointXYZI>(pcl_pointcloud, “rslidar”);
ui->openGLWidget->update();
renWin->Render();
}

Hello,

Where do you reset stop_bool? If it is false and never changes, you’ll have an infinite loop and your program just hangs. Also, is there a reason to load the data and render the scene in a loop?

If stop_bool is reset in, say, the click event of a button, you must yield execution to Qt from inside the for loop so it can process user events that may be queued. Maybe putting a QApplication::processEvents() inside the loop will do.

regards,

Paulo

1 Like

Hello @Paulo_Carvalho

Finally I got it!!!
I added QCoreApplication::processEvents() in while loop.
Thanks for all of your suggestion. :innocent:

1 Like