<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><span id="zwchr" data-marker="__DIVIDER__">----- On Feb 5, 2016, at 11:15 AM, Elvis Stansvik <elvis.stansvik@orexplore.com> wrote:<br></span><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-02-05 18:46 GMT+01:00  <span dir="ltr"><<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a>></span>:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;" data-mce-style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;"><div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000;" data-mce-style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000;"><div><div class="h5"><br><br><span>----- On Feb 5, 2016, at 10:26 AM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br></span></div></div><div><div><div class="h5"><blockquote style="border-left: 2px solid #1010ff; margin-left: 5px; padding-left: 5px; color: #000000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010ff; margin-left: 5px; padding-left: 5px; color: #000000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 5, 2016 at 9:15 AM, Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;" data-mce-style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><br></span><div>Alright, so you've heard about it before? Should there ever be a need for QGLWidget, or should it be reported as a bug?<br><br></div><div>My system:<br><br>Thinkpad T440s<br>Intel HD Graphics 4400<br></div><div>Qt 5.5.1 / PyQt5 5.4.2 / VTK 6.2.0<br><br></div><div>All installed from Kubuntu repos (with backports repositories enabled).<br><br></div><div>I have no reason not to use QGLWidget instead of QWidget, so it's not a big problem. I was mostly curious if others have seen this problem.<br></div></div></div></div></blockquote><br><div>Yes, the depth buffer for the context seems to be missing.  The person who submitted the QGLWidget patch had exactly the same issue:</div><div><a href="https://gitlab.kitware.com/vtk/vtk/merge_requests/1097" target="_blank">https://gitlab.kitware.com/vtk/vtk/merge_requests/1097</a></div><br><div>That was for linux on a virtual machine, so I thought it was the fault of the virtual machine.  But maybe it wasn't after all!</div><br><div>I use linux as well, with NVidia graphics, for me it works without QGLWidget.</div><br><div> - David</div></div></div></div></blockquote><br></div></div><div>Perhaps the following explanation will clear some things up, and help people understand when and why the problems shows up.</div><br><div>The C++ QVTKWidget class addresses this issue by controlling the X11 visual when creating the window.  See QVTKWidget::x11_setup_window().</div><div>I don't think this issue is related to what OpenGL driver is used, but rather what X11 visual is the default or chosen by Qt.</div><br><div>On Linux, you can run</div><div>$ xdpyinfo | default</div><div>to get the default visual for the X11 server.</div><div>In my case, its</div><div>default visual id: 0x21</div><br><div>Then you run glxinfo to look up the capabilities of the default visual.</div><br><div>In my case, visual 0x21 has the following capabilities.</div><div> visual x bf lv rg d st colorbuffer sr ax dp st accumbuffer ms cav<br> id dep cl sp sz l ci b ro r g b a F gb bf th cl r g b a ns b eat<br>----------------------------------------------------------------------------<br>0x021 24 tc 0 24 0 r y . 8 8 8 0 . s 4 24 8 16 16 16 16 0 0 None<br></div><br><div>My default visual 0x21 supports a depth buffer, but not alpha.  To get alpha working with VTK, a different visual would be needed.</div><br><div>When mixing OpenGL and X11, the application code is responsible for choosing the X11 visual that supports the capabilities one wants to get from OpenGL.</div><div>By using QWidget, you get the default visual, unless overridden.  By using QGLWidget, you possibly get another one, depending on the logic in QGLWidget based on QGLFormat.  The default QGLFormat may or may not give you what you are expecting to get with VTK.  Also, when using QGLWidget, you now have a window with 2 opengl contexts created for it.  One by VTK, and another by Qt - and I find that confusing.</div><br><div>In Qt 4.8, the QApplication constructor had support for specifying visuals, but that appears to have gone away with Qt 5.</div></div></div></div></blockquote><br><div>Thanks for the detailed info Clint, I'm still digesting it.<br><br></div><div>On my system I get:<br><br>[estan@pyret ~]$ xdpyinfo | grep default<br>default screen number:    0<br>  default colormap:    0x22<br>  default number of colormap cells:    256<br>  default visual id:  0x20<br>[estan@pyret ~]$ glxinfo | grep 0x020<br>0x020 24 tc  0  32  0 r  y .   8  8  8  8 .  .  0 24  8  0  0  0  0  0 0 None<br><br></div><div>I'm not sure what these means.<br><br></div><div>But in any case, is there really no Qt 5 API which VTK could use to request an X11 visual that has the required capabilities?<br><br></div><div>Thanks for shedding light on this, I'll go with QGLWidget when working on my laptop for now. But yes, I also find the double GL contexts strange.<br></div></div></div></div></blockquote><div><br></div><div>You can try passing into QApplication the visual you want to use.</div><div>QApplication(['QVTKRenderWindowInteractor', '-visual', '25'])<br></div><div><br data-mce-bogus="1"></div><div>Perhaps trying different visuals listed by glxinfo will help in understanding the issue.</div><div><br data-mce-bogus="1"></div><div>Clint</div></div></div></body></html>