[vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output?
elvis.stansvik at orexplore.com
Thu Jun 30 03:19:29 EDT 2016
2016-06-29 22:52 GMT+02:00 <clinton at elemtech.com>:
> ----- 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
> >> 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 , 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.
Alright, good to know, thanks.
> One possible workaround is to do something like the following in your
> main() before the QApplication is constructed.
> QSurfaceFormat fmt;
Hm, but isn't QSurfaceFormat only about the context set up by the new (or
well, somewhat new) QOpenGLWidget? If you mean you are using a context from
QGLWidget (through QVTKWidget2), then shouldn't QGLFormat be used instead?
> 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
Yes, this is what I did (and also
fmt.setProfile(QSurfaceFormat.CompatibilityProfile) when experimenting with
trying to get a QOpenGLWidget-backed widget working from Python (á la
in order for VTK to accept the context.
> However, that may not be necessary because in the case of QVTKWidget, VTK
> is creating OpenGL contexts, not Qt.
Right, that's what I also found out when looking at the code.
> 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.
With "that information", do you mean information about what OpenGL version
the render needs? No I guess not, I guess you just have to target a certain
VTK version and use fixed numbers in the calls to .setMajor/MinorVersion.
But, like you say, with QVTKWidget, VTK is creating the OpenGL context, so
there's nothing to .setMajorMinor/Version on, or am I missing something?
> Anyway, perhaps these workarounds will help.
I'm not sure, if QSurfaceFormat is only for QOpenGLWidget, I would have to
have a working QOpenGLWidget-based VTK widget first. But it was interesting
that you set the depth/alpha/stencil buffers as well, since I only used it
to set the number of samples when I experimented with QOpenGLWidget.
Perhaps I should give it a try again.
In the end, I would still be very interested to hear if anyone knows what
would be the best backend + VTK widget to use given the hardware I need to
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers