<div dir="ltr">Elvis,<div><br></div><div>I am not sure what the ITK-SNAP thing is. No, I don't think setting required opengl version is the way to go.</div><div><br></div><div>If I am following all your emails correctly, then the latest state is that my suggestion works on mac and you're going to confirm on Windows next.</div><div><br></div><div>If problems persist, it would be immensely helpful if you have an example that does the "highlight" e.g. modify TestQVTKOpenGLWidget.cxx[1] to add an actor for the "thing". That way I have a easy test case to reproduce your issue and then debug it. </div><div><br></div><div>Utkarsh</div><div><br></div><div>[1] <a href="https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/Qt/Testing/Cxx/TestQVTKOpenGLWidget.cxx">https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/Qt/Testing/Cxx/TestQVTKOpenGLWidget.cxx</a></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 22, 2017 at 8:47 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">2017-05-22 13:39 GMT+02:00 Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>><wbr>:<br>
> 2017-05-18 16:14 GMT+02:00 Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>><wbr>:<br>
>> 2017-05-18 15:59 GMT+02:00 Utkarsh Ayachit <<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>>:<br>
>>> For now, try doing this:<br>
>>>   auto surfaceFormat = QVTKOpenGLWidget::<wbr>defaultFormat()<br>
>>>   surfaceFormat.setSamples(0);<br>
>>>   surfaceFormat.<wbr>setAlphaBufferSIze(0);<br>
>>>   QSurfaceFormat::<wbr>setDefaultFormat(<wbr>surfaceFormat);<br>
>><br>
>> Thanks for the suggestion. I tried it out on the Mac, but it looks<br>
>> like it made no difference :/<br>
><br>
> I'm really sorry, this must have been a PEBKAC from me, because now<br>
> that I tried it again, it actually does solve the problem (!). I must<br>
> have made some mistake first time I tried it.<br>
><br>
> Rendering on the Mac is now correct. I will have to wait until I get<br>
> access to the Windows/nVidia machine again to confirm that it solves<br>
> it there too, but I'm hopeful that it does.<br>
><br>
> (Note: I sent off a couple of e-mails earlier today with some<br>
> screenshots from the Mac, that ended up in the moderation queue due to<br>
> the screenshots being > 1000 KB).<br>
><br>
> Many thanks for this tip Utkarsh.<br>
<br>
</span>As a side note: I found this in the source code for ITK-SNAP [1]:<br>
<br>
// Starting with Qt 5.6, the OpenGL implementation uses OpenGL 2.0<br>
// In this version of OpenGL, transparency is handled differently and<br>
// looks wrong.<br>
QSurfaceFormat gl_fmt;<br>
gl_fmt.setMajorVersion(<wbr>argdata.opengl_major);<br>
gl_fmt.setMinorVersion(<wbr>argdata.opengl_minor);<br>
/*<br>
gl_fmt.setSwapBehavior(<wbr>QSurfaceFormat::DoubleBuffer);<br>
gl_fmt.setRedBufferSize(1);<br>
gl_fmt.setGreenBufferSize(1);<br>
gl_fmt.setBlueBufferSize(1);<br>
gl_fmt.setDepthBufferSize(1);<br>
gl_fmt.setStencilBufferSize(0)<wbr>;<br>
gl_fmt.setAlphaBufferSize(0);<br>
*/<br>
<br>
I'm guessing the comment is referring to the same issue I saw. Note<br>
the commented setAlphaBufferSize(0). So is setting the GL version<br>
explicitly like this the proper workaround?<br>
<br>
Elvis<br>
<br>
[1] <a href="https://github.com/pyushkevich/itksnap/blob/master/GUI/Qt/main.cxx#L572-L574" rel="noreferrer" target="_blank">https://github.com/<wbr>pyushkevich/itksnap/blob/<wbr>master/GUI/Qt/main.cxx#L572-<wbr>L574</a><br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Elvis<br>
><br>
>><br>
>> Elvis<br>
>><br>
>>><br>
>>><br>
>>> Utkarsh<br>
>>><br>
>>> On Thu, May 18, 2017 at 8:57 AM, Elvis Stansvik<br>
>>> <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>> wrote:<br>
>>>><br>
>>>> I'm porting our program to the new QVTKOpenGLWidget.<br>
>>>><br>
>>>> In one place, we're using a semi-transparent polygonal cube to show<br>
>>>> the selection of an area. We're doing volume rendering using<br>
>>>> vtkGPUVolumeRayCastMapper in the same renderer, and the polygonal<br>
>>>> selection marker is enclosing the volume in the X/Y dimensions.<br>
>>>><br>
>>>> See the attached linux_selection_correct.png for how this is supposed<br>
>>>> to look, and you'll understand what I mean. The light blue area is the<br>
>>>> selection marker.<br>
>>>><br>
>>>> This has always worked fine, but after porting from QVTKWidget to<br>
>>>> QVTKOpenGLWidget, the rendering looks strange on Windows (nvidia) and<br>
>>>> macOS (2013 MBP, intel iris). See the attached<br>
>>>> windows_nvidia_selection.png and macos_selection.png.<br>
>>>><br>
>>>> The selection is visualized using<br>
>>>><br>
>>>>   vtkCubeSource -> vtkPolyDataMapper<br>
>>>><br>
>>>> and a vtkActor configured like this:<br>
>>>><br>
>>>>     auto selectionColor = palette().color(QPalette::<wbr>Highlight);<br>
>>>><br>
>>>>     m_selectionMarkerActor-><wbr>SetMapper(<wbr>selectionMarkerMapper);<br>
>>>>     m_selectionMarkerActor-><wbr>GetProperty()->SetColor(<wbr>selectionColor.redF(),<br>
>>>><br>
>>>> selectionColor.greenF(),<br>
>>>><br>
>>>> selectionColor.blueF());<br>
>>>>     m_selectionMarkerActor-><wbr>GetProperty()->SetOpacity(0.1)<wbr>;<br>
>>>>     m_selectionMarkerActor-><wbr>GetProperty()->SetAmbient(1.0)<wbr>;<br>
>>>>     m_selectionMarkerActor-><wbr>GetProperty()->SetDiffuse(0.0)<wbr>;<br>
>>>>     m_selectionMarkerActor-><wbr>GetProperty()->SetSpecular(0.<wbr>0);<br>
>>>><br>
>>>> Any idea why the rendering looks so strange on Windows/nvidia and<br>
>>>> macOS/iris, respectively, when using the new widget class?<br>
>>>><br>
>>>> We're using a recent VTK from Git master.<br>
>>>><br>
>>>> We're doing the recommended<br>
>>>><br>
>>>>     QSurfaceFormat::<wbr>setDefaultFormat(<wbr>QVTKOpenGLWidget::<wbr>defaultFormat());<br>
>>>><br>
>>>> to set the default surface format before QApplication construction.<br>
>>>><br>
>>>> In the particular QVTKOpenGLWidget used here, we modify the format with<br>
>>>><br>
>>>>     auto surfaceFormat = format();<br>
>>>>     surfaceFormat.setSamples(0);<br>
>>>>     setFormat(surfaceFormat);<br>
>>>><br>
>>>> to disable multisampling.<br>
>>>><br>
>>>> Very grateful for any advise on how to solve this.<br>
>>>><br>
>>>> Cheers,<br>
>>>> Elvis<br>
>>>><br>
>>>> ______________________________<wbr>_________________<br>
>>>> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>>>><br>
>>>> Visit other Kitware open-source projects at<br>
>>>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>>>><br>
>>>> Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtk-developers</a><br>
>>>><br>
>>>> Follow this link to subscribe/unsubscribe:<br>
>>>> <a href="http://public.kitware.com/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtk-<wbr>developers</a><br>
>>>><br>
>>>><br>
>>><br>
</div></div></blockquote></div><br></div>