# Glitches when passing from QVTKWidget to QVTKOpenGLWidget

**URL:** https://discourse.vtk.org/t/glitches-when-passing-from-qvtkwidget-to-qvtkopenglwidget/3068
**Category:** Development
**Created:** [April 16, 2020, 11:21am UTC](https://discourse.vtk.org/t/glitches-when-passing-from-qvtkwidget-to-qvtkopenglwidget/3068 "2020-04-16T11:21:31Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![embeddedmz](https://discourse.vtk.org/user_avatar/discourse.vtk.org/embeddedmz/32/12_2.png) [@embeddedmz](https://discourse.vtk.org/u/embeddedmz)
#### Post date: [April 16, 2020, 11:21am UTC](https://discourse.vtk.org/t/glitches-when-passing-from-qvtkwidget-to-qvtkopenglwidget/3068/1 "2020-04-16T11:21:32Z")

</div>

Hi,

There’s this project I’m using in one of my company’s product [https://github.com/OpenGeoscience/vtkMap](https://github.com/OpenGeoscience/vtkMap) it’s a slippy map.

In applications/weatherstations, there’s an example of a Qt application using that project. A QVTKWidget is used to display the map :

[https://discourse.paraview.org/uploads/default/original/2X/b/b0fd44e3cbff508f856f953d325fc4673870f8fe.png](https://discourse.paraview.org/uploads/default/original/2X/b/b0fd44e3cbff508f856f953d325fc4673870f8fe.png)

I changed the QVTKWidget / vtkRenderWindow by a QVTKOpenGLWidget / vtkGenericOpenGLRenderWindow and everything is glitchy : [https://discourse.paraview.org/uploads/default/original/2X/d/d6bcc6535c625e125148c2965a7ab81beee6aef2.png](https://discourse.paraview.org/uploads/default/original/2X/d/d6bcc6535c625e125148c2965a7ab81beee6aef2.png)

I didn’t forget to add this before QApplication :  
`QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());`

I compiled the application under 3 different systems (Windows 8, KUbuntu and Centos 7) with different GPUs and the result is always the same (glitchs or the map tiles are not displayed).

When using that project in a program where ParaView is embedded, there’s no glitchs with QVTKOpenGLWidget (see : [https://discourse.paraview.org/t/paraview-opengl-version/4065](https://discourse.paraview.org/t/paraview-opengl-version/4065)).

So, I believe there’s a cure for these glitches but I didn’t find it !

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [April 16, 2020, 12:54pm UTC](https://discourse.vtk.org/t/glitches-when-passing-from-qvtkwidget-to-qvtkopenglwidget/3068/2 "2020-04-16T12:54:01Z")

</div>

Setting surface format is just part of the story. Qt/VTK application initialization steps are very delicate - you need to perform all the steps and in the correct order. I would recommend to copy the steps from large projects, such as Paraview, because several developers worked very hard on getting those right and they are tested by thousands of users on various platforms.

---

<div class="post-metadata">

### Author: ![embeddedmz](https://discourse.vtk.org/user_avatar/discourse.vtk.org/embeddedmz/32/12_2.png) [@embeddedmz](https://discourse.vtk.org/u/embeddedmz)
#### Post date: [April 16, 2020, 8:59pm UTC](https://discourse.vtk.org/t/glitches-when-passing-from-qvtkwidget-to-qvtkopenglwidget/3068/3 "2020-04-16T20:59:41Z")

</div>

Hi @lassoan

I did, but I still have glitches ! Do you know which version of VTK ParaView 5.4.1 is based ? I didn’t find that info. I want to build that VTK version and try with vtkMap, because when I’m using the VTK classes from ParaView 5.4.1 libraries I don’t have glitches in vtkMap.

Thanks.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [April 16, 2020, 9:08pm UTC](https://discourse.vtk.org/t/glitches-when-passing-from-qvtkwidget-to-qvtkopenglwidget/3068/4 "2020-04-16T21:08:22Z")

</div>

You can ask such details about Paraview on [their forum](https://discourse.paraview.org/).

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [April 16, 2020, 9:14pm UTC](https://discourse.vtk.org/t/glitches-when-passing-from-qvtkwidget-to-qvtkopenglwidget/3068/5 "2020-04-16T21:14:40Z")

</div>

ParaView doesn’t track a VTK release, but a commit on the master branch at some point. 5.4.1 uses VTK commit a9b132548dc19b8e20898b424b31cafacbf39246.

---

<div class="post-metadata">

### Author: ![embeddedmz](https://discourse.vtk.org/user_avatar/discourse.vtk.org/embeddedmz/32/12_2.png) [@embeddedmz](https://discourse.vtk.org/u/embeddedmz)
#### Post date: [April 17, 2020, 2:42pm UTC](https://discourse.vtk.org/t/glitches-when-passing-from-qvtkwidget-to-qvtkopenglwidget/3068/6 "2020-04-17T14:42:42Z")

</div>

Thank you very much @cory.quammen

With the same code (weather stations Qt example from vtkMap) :

With VTK 8.0.0.rc1-54-ga9b1325 (the one used in ParaView 5.4.1), there’s no glitches :

![wsmap_vtk_8_0_0](https://discourse.vtk.org/uploads/default/original/2X/4/46268e096d44d3da5740b9000354650187e92bce.png)

With VTK 8.2.0 (I initialized the QSurface properly)  
 ![wsmap_vtk_8_2_0](https://discourse.vtk.org/uploads/default/original/2X/9/92746535d7440ab4c486714285daff8bf23412e6.png)

With the latest VTK from master (using QVTKOpenGLStereoWidget and QVTKRenderWindowAdapter::defaultFormat to initialize the QSurfaceFormat’s default format)

I managed to have this result by playing with the camera (possible with 8.2.0 too)  
 ![wsmap_vtk_master](https://discourse.vtk.org/uploads/default/original/2X/d/d92a4d1ae86acb7bc67e14150d93767acb91211b.png)

but this is the first result :  
 ![wsmap_vtk_master_2](https://discourse.vtk.org/uploads/default/original/2X/5/5178c6f9ac75a52e1171f5c8a119edb8bcc6f45d.png)

Otherwise, without using Qt (X11 window ?), there’s no glitches with all the versions.
