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

Andras Lasso lasso at queensu.ca
Mon Jul 9 12:33:35 EDT 2018


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180709/4679180e/attachment.html>


More information about the vtkusers mailing list