[vtkusers] VTK 6.2 and PyQt5?
Elvis Stansvik
elvis.stansvik at orexplore.com
Fri Feb 5 13:19:10 EST 2016
2016-02-05 19:15 GMT+01:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
> 2016-02-05 18:46 GMT+01:00 <clinton at elemtech.com>:
>
>>
>>
>> ----- On Feb 5, 2016, at 10:26 AM, David Gobbi <david.gobbi at gmail.com>
>> wrote:
>>
>> On Fri, Feb 5, 2016 at 9:15 AM, Elvis Stansvik <
>> elvis.stansvik at orexplore.com> wrote:
>>
>>>
>>> Alright, so you've heard about it before? Should there ever be a need
>>> for QGLWidget, or should it be reported as a bug?
>>>
>>> My system:
>>>
>>> Thinkpad T440s
>>> Intel HD Graphics 4400
>>> Qt 5.5.1 / PyQt5 5.4.2 / VTK 6.2.0
>>>
>>> All installed from Kubuntu repos (with backports repositories enabled).
>>>
>>> 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.
>>>
>>
>> Yes, the depth buffer for the context seems to be missing. The person
>> who submitted the QGLWidget patch had exactly the same issue:
>> https://gitlab.kitware.com/vtk/vtk/merge_requests/1097
>>
>> 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!
>>
>> I use linux as well, with NVidia graphics, for me it works without
>> QGLWidget.
>>
>> - David
>>
>>
>> Perhaps the following explanation will clear some things up, and help
>> people understand when and why the problems shows up.
>>
>> The C++ QVTKWidget class addresses this issue by controlling the X11
>> visual when creating the window. See QVTKWidget::x11_setup_window().
>> 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.
>>
>> On Linux, you can run
>> $ xdpyinfo | default
>> to get the default visual for the X11 server.
>> In my case, its
>> default visual id: 0x21
>>
>> Then you run glxinfo to look up the capabilities of the default visual.
>>
>> In my case, visual 0x21 has the following capabilities.
>> visual x bf lv rg d st colorbuffer sr ax dp st accumbuffer ms cav
>> 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
>>
>> ----------------------------------------------------------------------------
>> 0x021 24 tc 0 24 0 r y . 8 8 8 0 . s 4 24 8 16 16 16 16 0 0 None
>>
>> My default visual 0x21 supports a depth buffer, but not alpha. To get
>> alpha working with VTK, a different visual would be needed.
>>
>> 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.
>> 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.
>>
>> In Qt 4.8, the QApplication constructor had support for specifying
>> visuals, but that appears to have gone away with Qt 5.
>>
>
> Thanks for the detailed info Clint, I'm still digesting it.
>
> On my system I get:
>
> [estan at pyret ~]$ xdpyinfo | grep default
> default screen number: 0
> default colormap: 0x22
> default number of colormap cells: 256
> default visual id: 0x20
> [estan at pyret ~]$ glxinfo | grep 0x020
> 0x020 24 tc 0 32 0 r y . 8 8 8 8 . . 0 24 8 0 0 0 0 0 0
> None
>
With glxinfo -v I can get a little bit more readable output:
Visual ID: 20 depth=24 class=TrueColor, type=window,pixmap,pbuffer
bufferSize=32 level=0 renderType=rgba doubleBuffer=1 stereo=0
rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8 float=N sRGB=N
auxBuffers=0 depthSize=24 stencilSize=8
accum: redSize=0 greenSize=0 blueSize=0 alphaSize=0
multiSample=0 multiSampleBuffers=0
visualCaveat=None
Opaque.
Still not sure which of these I should be looking at to determine if this
is what spoils it for me. Is the problem lack of alpha in the X11 visual?
In the output above I have one alphaSize=8 and one alphaSize=0. I'm not
sure what the difference between the two is.
Elvis
> I'm not sure what these means.
>
> 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?
>
> 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.
>
> Elvis
>
>
>> Clint
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160205/5d792cbf/attachment.html>
More information about the vtkusers
mailing list