# Is it possible to visualize the point cloud in QVTKOpenGLWidget?

**URL:** https://discourse.vtk.org/t/is-it-possible-to-visualize-the-point-cloud-in-qvtkopenglwidget/8534
**Category:** Support
**Created:** [May 20, 2022, 5:13am UTC](https://discourse.vtk.org/t/is-it-possible-to-visualize-the-point-cloud-in-qvtkopenglwidget/8534 "2022-05-20T05:13:59Z")
**Posts on this page:** 4
**Page:** 2

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [June 14, 2022, 1:01pm UTC](https://discourse.vtk.org/t/is-it-possible-to-visualize-the-point-cloud-in-qvtkopenglwidget/8534/22 "2022-06-14T13:01:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Panda12197](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/e480ec/32.png) [@Panda12197](https://discourse.vtk.org/u/Panda12197)
#### Post date: [July 11, 2022, 7:35am UTC](https://discourse.vtk.org/t/is-it-possible-to-visualize-the-point-cloud-in-qvtkopenglwidget/8534/23 "2022-07-11T07:35:47Z")

</div>

@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. 😁  
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();  
> }

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [July 11, 2022, 8:01pm UTC](https://discourse.vtk.org/t/is-it-possible-to-visualize-the-point-cloud-in-qvtkopenglwidget/8534/24 "2022-07-11T20:01:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Panda12197](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/e480ec/32.png) [@Panda12197](https://discourse.vtk.org/u/Panda12197)
#### Post date: [July 12, 2022, 7:04am UTC](https://discourse.vtk.org/t/is-it-possible-to-visualize-the-point-cloud-in-qvtkopenglwidget/8534/25 "2022-07-12T07:04:09Z")

</div>

Hello @Paulo_Carvalho

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

[Previous page](https://discourse.vtk.org/t/is-it-possible-to-visualize-the-point-cloud-in-qvtkopenglwidget/8534.md?page=1)
