[vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output?

clinton at elemtech.com clinton at elemtech.com
Wed Jun 29 16:52:58 EDT 2016


----- On Jun 29, 2016, at 10:45 AM, Elvis Stansvik <elvis.stansvik at orexplore.com> wrote: 

> Den 29 juni 2016 6:07 em skrev "Shawn Waldon" < shawn.waldon at kitware.com >:


>>> I see, I may have misunderstood the role of QVTKWidget2 is vs QVTKWidget. I
>>> thought QVTKWidget2 was essentially a newer replacement for QVTKWidget, and to
> >> be preferred in new code.

>>> I've also misunderstood a little how the two widgets work. I knew QVTKWidget2
>>> makes use of the deprecated QGLWidget (and was in fact trying to make a similar
>>> Python class just recently, which uses QOpenGLWidget, but ran into some
>>> problems). But I also wrongly thought that QVTKWidget used QGLWidget, looking
> >> at the code I see now that it doesn't.

>>> So in short: I have no great need for QVTKWidget2, functionality-wise. So if
> >> using it precludes using the OpenGL2 backend, I'll use QVTKWidget instead.

>>> One thing I did like was that the code in QVTKWidget2 looked a little
>>> simpler/cleaner than the one QVTKWidget. It's always nice to be able to quickly
> >> check how something work.

>>> An officially supported widget, based on QOpenGLWidget and supporting the
>>> OpenGL2 backend, would be the absolutely best of course. In fact, there's an
>>> answer on StackOverflow where a user posted his QVTKWidget2 hacked to work with
> >> QOpenGLWidget [1], perhaps it could be used as a starting point?


>> So just to throw this out there, here is the situation as I understand it. Ben
>> (cc'd) can correct what I get wrong since he was one of the last to touch
> > QVTKWidget2.

>> QVTKWidget works fine with OpenGL2 if you are building against Qt4. But when you
>> build for Qt5 there are issues with creating the OpenGL context and letting Qt
>> know the context is there and so some features of the OpenGL2 backend don't
> > work right.

> Do you know which features and if this is being worked out?
I'm aware of some issues, and have looked briefly at Linux specific issues. 
For instance, QVTKWidget::x11_setup_window is disabled for Qt5 and there has not been a replacement for that yet. 

One possible workaround is to do something like the following in your main() before the QApplication is constructed. 
QSurfaceFormat fmt ; 
fmt . setDepthBufferSize ( 8 ); 
fmt . setSamples ( 1 ); 
fmt . setAlphaBufferSize ( 8 ); 
fmt . setStereo ( 1 ); 
fmt . setStencilBufferSize ( 8 ); 
QSurfaceFormat :: setDefaultFormat ( fmt ); 

It does fix some issues I'm able to replicate with the OpenGL backend. 
For OpenGL2 backend, and possibly applicable to any platform, perhaps you could try adding a 
fmt .setMajorVersion ( 3 ); 
fmt .setMajorVersion ( 2 ); 
However, that may not be necessary because in the case of QVTKWidget, VTK is creating OpenGL contexts, not Qt. 

I do not yet see a way for that information to be passed from vtkRenderWindow to QVTKWidget and down to Qt after the QApplication has been constructed. 
Anyway, perhaps these workarounds will help. 

Clint 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160629/a9b8c8c0/attachment.html>


More information about the vtkusers mailing list