# QtOpenGLNativeWidget - here's a simple broken example

**URL:** https://discourse.vtk.org/t/qtopenglnativewidget-heres-a-simple-broken-example/2089
**Category:** Support
**Created:** [November 13, 2019, 2:08am UTC](https://discourse.vtk.org/t/qtopenglnativewidget-heres-a-simple-broken-example/2089 "2019-11-13T02:08:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![DominionSoftware](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dominionsoftware/32/1064_2.png) [@DominionSoftware](https://discourse.vtk.org/u/DominionSoftware)
#### Post date: [November 13, 2019, 2:08am UTC](https://discourse.vtk.org/t/qtopenglnativewidget-heres-a-simple-broken-example/2089/1 "2019-11-13T02:08:41Z")

</div>

> **[DominionSoftware/QtOpenGLNativeWidget](https://github.com/DominionSoftware/QtOpenGLNativeWidget)**
>
> An example (currently not working) of rendering a volume into a QtOpenGLNativeWidget - DominionSoftware/QtOpenGLNativeWidget

Here’s a simple example of loading the plastic skull that is similar to Medical4 demo.

If someone could see what’s wrong with this code that would be great…

Thanks  
Rick

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 13, 2019, 5:54am UTC](https://discourse.vtk.org/t/qtopenglnativewidget-heres-a-simple-broken-example/2089/2 "2019-11-13T05:54:59Z")

</div>

Did you try with QVTKOpenGLWidget ?

---

<div class="post-metadata">

### Author: ![simonesneault](https://discourse.vtk.org/user_avatar/discourse.vtk.org/simonesneault/32/67_2.png) [@simonesneault](https://discourse.vtk.org/u/simonesneault)
#### Post date: [November 13, 2019, 8:47am UTC](https://discourse.vtk.org/t/qtopenglnativewidget-heres-a-simple-broken-example/2089/3 "2019-11-13T08:47:30Z")

</div>

Hello @DominionSoftware,  
I was able to build and run your software (it’s missing #include to build properly here 😉 )

To fix your problem, you need to disable MSAA.  
Insert `vtkGenericOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples( 0 );`  
Before the line `QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());` in your main.  
Here is the result

 ![PNG](https://discourse.vtk.org/uploads/default/original/2X/8/849ba169529d28554bd50ced087a6341af8d5e3a.jpeg)  
From my experience, I would strongly suggest _not_ to use `QVTKOpenGLWidget` if possible, we had to deal with quite a lot of pb here with that class, stick to `QtOpenGLNativeWidget` if you don’t need stereo rendering 🙂

---

<div class="post-metadata">

### Author: ![DominionSoftware](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dominionsoftware/32/1064_2.png) [@DominionSoftware](https://discourse.vtk.org/u/DominionSoftware)
#### Post date: [November 13, 2019, 9:41am UTC](https://discourse.vtk.org/t/qtopenglnativewidget-heres-a-simple-broken-example/2089/4 "2019-11-13T09:41:55Z")

</div>

Thanks!

Rick Frank  
Dominion Software, Inc.

825 Beacon Street

Newton, MA 02459

Medical, Scientific, and Industrial Software

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 13, 2019, 8:08pm UTC](https://discourse.vtk.org/t/qtopenglnativewidget-heres-a-simple-broken-example/2089/5 "2019-11-13T20:08:53Z")

</div>

@simonesneault : I fully agree with your QVTKopenGLWidget statement, It was just to provide a datapoint in order to fix the issue 🙂
