[vtkusers] Cannot disable vtkPolyDataMapper2D scalar visibility using VTK OpenGL2 backend

Ken Martin ken.martin at kitware.com
Mon Jul 9 15:52:53 EDT 2018


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.

e.g. it should look like this

  this->MapScalars(act->GetProperty()->GetOpacity());
  this->HaveCellScalars = false;
  if (this->ScalarVisibility)
  {
    // We must figure out how the scalars should be mapped to the polydata.
    if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||
          this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ||



On Mon, Jul 9, 2018 at 12:33 PM, Andras Lasso <lasso at queensu.ca> wrote:

> Hi all,
>
>
>
> 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.
>
>
>
> 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.
>
>
>
> Is this a known issue? Could somebody have a look?
>
>
>
> Thank you,
>
> Andras
>
>
>
>
>
> reader = vtk.vtkXMLPolyDataReader()
>
> reader.SetFileName("scalartest.vtp")
>
> mapper = vtk.vtkPolyDataMapper2D()
>
> mapper.SetInputConnection(reader.GetOutputPort())
>
> actor = vtk.vtkActor2D()
>
> actor.SetMapper(mapper)
>
> actor.SetPosition(150,150)
>
> ren = vtk.vtkRenderer()
>
> ren.AddActor(actor)
>
> renWin = vtk.vtkRenderWindow()
>
> renWin.AddRenderer(ren)
>
> renWin.Render()
>
> # actor appears in color here => OK
>
> mapper.SetScalarVisibility(False)
>
> renWin.Render()
>
> # actor appears in color here => ERROR (it should be white)
>
>
>
>
>
> Download link for scalartest.vtp sample data set (any other polydata with
> scalars should work):
>
> https://1drv.ms/u/s!Arm_AFxB9yqHtK1gHCIsGt0U62OTQg
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
101 East Weaver Street
Carrboro, North Carolina
27510 USA

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180709/edae6241/attachment.html>


More information about the vtkusers mailing list