<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><div><span id="zwchr" data-marker="__DIVIDER__">----- On Jun 29, 2016, at 10:45 AM, Elvis Stansvik <elvis.stansvik@orexplore.com> wrote:<br></span></div><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;"><p dir="ltr"><br> Den 29 juni 2016 6:07 em skrev "Shawn Waldon" <<a href="mailto:shawn.waldon@kitware.com" target="_blank" data-mce-href="mailto:shawn.waldon@kitware.com">shawn.waldon@kitware.com</a>>:<br> >><br> >><br> >> 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.<br> >><br> >> 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.<br> >><br> >> 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.<br> >><br> >> 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.<br> >><br> >> 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?<br> ><br> ><br> > 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.<br> ><br> > 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.</p><p dir="ltr">Do you know which features and if this is being worked out?</p></blockquote><div><br></div><div>I'm aware of some issues, and have looked briefly at Linux specific issues.</div><div>For instance, QVTKWidget::x11_setup_window is disabled for Qt5 and there has not been a replacement for that yet.</div><div><br></div><div>One possible workaround is to do something like the following in your main() before the QApplication is constructed.</div><div><pre style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;" data-mce-style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;"><span style="color: #c0c0c0;" data-mce-style="color: #c0c0c0;">    </span><span style="color: #800080;" data-mce-style="color: #800080;">QSurfaceFormat</span><span style="color: #c0c0c0;" data-mce-style="color: #c0c0c0;"> </span><span style="color: #000000;" data-mce-style="color: #000000;">fmt</span><span style="color: #000000;" data-mce-style="color: #000000;">;</span></pre><pre style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;" data-mce-style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;"><span style="color: #c0c0c0;" data-mce-style="color: #c0c0c0;">    </span><span style="color: #000000;" data-mce-style="color: #000000;">fmt</span><span style="color: #000000;" data-mce-style="color: #000000;">.</span><span style="color: #000000;" data-mce-style="color: #000000;">setDepthBufferSize</span><span style="color: #000000;" data-mce-style="color: #000000;">(</span><span style="color: #000080;" data-mce-style="color: #000080;">8</span><span style="color: #000000;" data-mce-style="color: #000000;">);</span></pre><pre style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;" data-mce-style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;"><span style="color: #c0c0c0;" data-mce-style="color: #c0c0c0;">    </span><span style="color: #000000;" data-mce-style="color: #000000;">fmt</span><span style="color: #000000;" data-mce-style="color: #000000;">.</span><span style="color: #000000;" data-mce-style="color: #000000;">setSamples</span><span style="color: #000000;" data-mce-style="color: #000000;">(</span><span style="color: #000080;" data-mce-style="color: #000080;">1</span><span style="color: #000000;" data-mce-style="color: #000000;">);</span></pre><pre style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;" data-mce-style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;"><span style="color: #c0c0c0;" data-mce-style="color: #c0c0c0;">    </span><span style="color: #000000;" data-mce-style="color: #000000;">fmt</span><span style="color: #000000;" data-mce-style="color: #000000;">.</span><span style="color: #000000;" data-mce-style="color: #000000;">setAlphaBufferSize</span><span style="color: #000000;" data-mce-style="color: #000000;">(</span><span style="color: #000080;" data-mce-style="color: #000080;">8</span><span style="color: #000000;" data-mce-style="color: #000000;">);</span></pre><pre style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;" data-mce-style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;"><span style="color: #c0c0c0;" data-mce-style="color: #c0c0c0;">    </span><span style="color: #000000;" data-mce-style="color: #000000;">fmt</span><span style="color: #000000;" data-mce-style="color: #000000;">.</span><span style="color: #000000;" data-mce-style="color: #000000;">setStereo</span><span style="color: #000000;" data-mce-style="color: #000000;">(</span><span style="color: #000080;" data-mce-style="color: #000080;">1</span><span style="color: #000000;" data-mce-style="color: #000000;">);</span></pre><pre style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;" data-mce-style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;"><span style="color: #c0c0c0;" data-mce-style="color: #c0c0c0;">    </span><span style="color: #000000;" data-mce-style="color: #000000;">fmt</span><span style="color: #000000;" data-mce-style="color: #000000;">.</span><span style="color: #000000;" data-mce-style="color: #000000;">setStencilBufferSize</span><span style="color: #000000;" data-mce-style="color: #000000;">(</span><span style="color: #000080;" data-mce-style="color: #000080;">8</span><span style="color: #000000;" data-mce-style="color: #000000;">);<br></span><span data-mce-style="color: #c0c0c0;" style="color: #c0c0c0;">    </span><span data-mce-style="color: #800080;" style="color: #800080;">QSurfaceFormat</span><span data-mce-style="color: #000000;" style="color: #000000;">::</span><span data-mce-style="color: #000000;" style="color: #000000;">setDefaultFormat</span><span data-mce-style="color: #000000;" style="color: #000000;">(</span><span data-mce-style="color: #000000;" style="color: #000000;">fmt</span><span data-mce-style="color: #000000;" style="color: #000000;">);</span></pre></div><div><br></div><div><br></div><div>It does fix some issues I'm able to replicate with the OpenGL backend.</div><div>For OpenGL2 backend, and possibly applicable to any platform, perhaps you could try adding a<br></div><div><pre data-mce-style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;" style="font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; background-color: rgb(255, 255, 255);"><span data-mce-style="color: #c0c0c0;" style="color: rgb(192, 192, 192);">    </span><span data-mce-style="color: #000000;" style="color: rgb(0, 0, 0);">fmt</span><span data-mce-style="color: #000000;" style="color: rgb(0, 0, 0);">.setMajorVersion</span><span data-mce-style="color: #000000;" style="color: rgb(0, 0, 0);">(</span><span data-mce-style="color: #000000;"><span color="#000080" data-mce-style="color: #000080;" style="color: #000080;">3</span></span><span data-mce-style="color: #000000;" style="color: rgb(0, 0, 0);">);<br></span></pre></div><div><div style="font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><pre data-mce-style="-qt-block-indent: 0; text-indent: 0px; margin: 0px;" style="font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; background-color: rgb(255, 255, 255);"><span data-mce-style="color: #c0c0c0;" style="color: rgb(192, 192, 192);">    </span><span data-mce-style="color: #000000;" style="color: rgb(0, 0, 0);">fmt</span><span data-mce-style="color: #000000;" style="color: rgb(0, 0, 0);">.setMajorVersion</span><span data-mce-style="color: #000000;" style="color: rgb(0, 0, 0);">(</span><span data-mce-style="color: #000000;"><span color="#000080" data-mce-style="color: #000080;" style="color: #000080;">2</span></span><span data-mce-style="color: #000000;" style="color: rgb(0, 0, 0);">);<br></span></pre></div></div><div>However, that may not be necessary because in the case of QVTKWidget, VTK is creating OpenGL contexts, not Qt.</div><div><br></div><div>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.<br></div><div>Anyway, perhaps these workarounds will help.<br></div><div><br data-mce-bogus="1"></div><div>Clint</div><div><br data-mce-bogus="1"></div></div></div></body></html>