<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Thanks a lot Ken for the quick response. The change that you described below fixed the issue!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Andras<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> Ken Martin <ken.martin@kitware.com> <br>
<b>Sent:</b> Monday, July 9, 2018 3:53 PM<br>
<b>To:</b> Andras Lasso <lasso@queensu.ca><br>
<b>Cc:</b> vtkusers@vtk.org<br>
<b>Subject:</b> Re: [vtkusers] Cannot disable vtkPolyDataMapper2D scalar visibility using VTK OpenGL2 backend<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">e.g. it should look like this<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"> this->MapScalars(act->GetProperty()->GetOpacity());<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> this->HaveCellScalars = false;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> if (this->ScalarVisibility)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> {<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> // We must figure out how the scalars should be mapped to the polydata.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ||<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Mon, Jul 9, 2018 at 12:33 PM, Andras Lasso <<a href="mailto:lasso@queensu.ca" target="_blank">lasso@queensu.ca</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi all,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">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.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">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.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Is this a known issue? Could somebody have a look?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thank you,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Andras<o:p></o:p></p>
<div style="border:none;border-bottom:solid windowtext 1.0pt;padding:0cm 0cm 1.0pt 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">reader = vtk.vtkXMLPolyDataReader()<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">reader.SetFileName("scalartest.vtp")<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">mapper = vtk.vtkPolyDataMapper2D()<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">mapper.SetInputConnection(reader.GetOutputPort())<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">actor = vtk.vtkActor2D()<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">actor.SetMapper(mapper)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">actor.SetPosition(150,150)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">ren = vtk.vtkRenderer()<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">ren.AddActor(actor)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">renWin = vtk.vtkRenderWindow()<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">renWin.AddRenderer(ren)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">renWin.Render()<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"># actor appears in color here => OK<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">mapper.SetScalarVisibility(False)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">renWin.Render()<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"># actor appears in color here => ERROR (it should be white)<o:p></o:p></p>
<div style="border:none;border-bottom:solid windowtext 1.0pt;padding:0cm 0cm 1.0pt 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Download link for scalartest.vtp sample data set (any other polydata with scalars should work):<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2F1drv.ms%2Fu%2Fs!Arm_AFxB9yqHtK1gHCIsGt0U62OTQg&data=02%7C01%7Classo%40queensu.ca%7Ce06fabd733c540fd9c4a08d5e5d59008%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636667627766232634&sdata=qosMAzacqE779GLw69Pogi1Rayk%2B%2F%2FTX5tJ2SGm8VWs%3D&reserved=0" target="_blank">https://1drv.ms/u/s!Arm_AFxB9yqHtK1gHCIsGt0U62OTQg</a><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Powered by <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=02%7C01%7Classo%40queensu.ca%7Ce06fabd733c540fd9c4a08d5e5d59008%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636667627766232634&sdata=Q5elxCkAVlQA861ll43jK29n1Shhq616iKUHSv%2FaB88%3D&reserved=0" target="_blank">
www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7Ce06fabd733c540fd9c4a08d5e5d59008%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636667627766232634&sdata=9u1SGTHnY%2FTwxPLLYkNbGKgSUxLPoT1kLETaE5iYpWA%3D&reserved=0" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7Ce06fabd733c540fd9c4a08d5e5d59008%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636667627766232634&sdata=tk3W1q3O64ZNy8BaH%2FHmFJkT9pKBqnaH24TkNNG92D4%3D&reserved=0" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7Ce06fabd733c540fd9c4a08d5e5d59008%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636667627766232634&sdata=G%2FLjb5W%2Fa7LAb5RSS6oqjTHklNT0wpPi6b2Tb21I9Z4%3D&reserved=0" target="_blank">
http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7Ce06fabd733c540fd9c4a08d5e5d59008%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636667627766232634&sdata=urx%2BU7azPuK2Sg9bBJN%2BWb6dVxafyGrYRvHEAQST4%2Bw%3D&reserved=0" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Ken Martin PhD<o:p></o:p></p>
<div>
<p class="MsoNormal">Distinguished Engineer<br>
<span style="font-size:9.5pt">Kitware Inc.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">101 East Weaver Street<br>
Carrboro, North Carolina<br>
27510 USA<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;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><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>