<div dir="ltr">Sounds like a bug. Andras if you move line 568 from vtkOpenGLPolyDataMapper2D.cxx out of the if statement to line 563 does that solve the problem? Looking at the code I believe that is the correct fix.<div><br></div><div>e.g. it should look like this</div><div><br></div><div><div> this->MapScalars(act->GetProperty()->GetOpacity());</div><div> this->HaveCellScalars = false;</div><div> if (this->ScalarVisibility)</div><div> {</div><div> // We must figure out how the scalars should be mapped to the polydata.</div><div> if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||</div><div> this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ||</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 9, 2018 at 12:33 PM, Andras Lasso <span dir="ltr"><<a href="mailto:lasso@queensu.ca" target="_blank">lasso@queensu.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_4191149016506801813WordSection1">
<p class="MsoNormal">Hi all,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I try to render a polydata with a plain solid color using a 2D actor. However, it seems that with OpenGL2 rendering backend, if a polydata has scalars and rendered once with scalar visibility enabled, ScalarVisibility cannot be disabled
anymore. The actor will always appear as colored. In some cases, the colors randomly flicker. See a very simple code snippet below to reproduce it.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The same code works well (scalar visibility can be enabled/disabled) using VTK OpenGL1 backend. If I use 3D mapper and actor (vtkPolyDataMapper and vtk.vtkActor) then it works well using both VTK OpenGL1 and OpenGL2 backends.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Is this a known issue? Could somebody have a look?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thank you,<u></u><u></u></p>
<p class="MsoNormal">Andras<u></u><u></u></p>
<div style="border:none;border-bottom:solid windowtext 1.0pt;padding:0cm 0cm 1.0pt 0cm">
<p class="MsoNormal" style="border:none;padding:0cm"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">reader = vtk.vtkXMLPolyDataReader()<u></u><u></u></p>
<p class="MsoNormal">reader.SetFileName("<wbr>scalartest.vtp")<u></u><u></u></p>
<p class="MsoNormal">mapper = vtk.vtkPolyDataMapper2D()<u></u><u></u></p>
<p class="MsoNormal">mapper.SetInputConnection(<wbr>reader.GetOutputPort())<u></u><u></u></p>
<p class="MsoNormal">actor = vtk.vtkActor2D()<u></u><u></u></p>
<p class="MsoNormal">actor.SetMapper(mapper)<u></u><u></u></p>
<p class="MsoNormal">actor.SetPosition(150,150)<u></u><u></u></p>
<p class="MsoNormal">ren = vtk.vtkRenderer()<u></u><u></u></p>
<p class="MsoNormal">ren.AddActor(actor)<u></u><u></u></p>
<p class="MsoNormal">renWin = vtk.vtkRenderWindow()<u></u><u></u></p>
<p class="MsoNormal">renWin.AddRenderer(ren)<u></u><u></u></p>
<p class="MsoNormal">renWin.Render()<u></u><u></u></p>
<p class="MsoNormal"># actor appears in color here => OK<u></u><u></u></p>
<p class="MsoNormal">mapper.SetScalarVisibility(<wbr>False)<u></u><u></u></p>
<p class="MsoNormal">renWin.Render()<u></u><u></u></p>
<p class="MsoNormal"># actor appears in color here => ERROR (it should be white)<u></u><u></u></p>
<div style="border:none;border-bottom:solid windowtext 1.0pt;padding:0cm 0cm 1.0pt 0cm">
<p class="MsoNormal" style="border:none;padding:0cm"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Download link for scalartest.vtp sample data set (any other polydata with scalars should work):<u></u><u></u></p>
<p class="MsoNormal"><a href="https://1drv.ms/u/s!Arm_AFxB9yqHtK1gHCIsGt0U62OTQg" target="_blank">https://1drv.ms/u/s!Arm_<wbr>AFxB9yqHtK1gHCIsGt0U62OTQg</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<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 <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Ken Martin PhD<div>Distinguished Engineer<br><span style="font-size:12.8px">Kitware Inc.</span><br></div><div>101 East Weaver Street<br>Carrboro, North Carolina<br>
27510 USA<br><br><div><span style="font-size:10pt;font-family:Tahoma,sans-serif">This communication,
including all attachments, contains confidential and legally privileged
information, and it is intended only for the use of the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken in reliance on it is prohibited and may be
unlawful. If you received this communication in error please notify us
immediately and destroy the original message.
Thank you.</span></div></div></div></div></div></div></div>
</div>