PolydataMapper vs DataSetMapper

I’ve seen some examples using vtkDataSetMapper and others using vtkPolyDataMapper.
(On a closer look to the vtkDataSetMapper implementation, I see that it actually creates a vtkPolyDataMapper and I noticed there is already a check to prevent the input from passing through the geometry filter if it’s a vtkPolyData.)

With that been said, should I use vtkPolyDataMapper directly when the input is a vtkPolyData or can I use vtkDataSetMapper for all cases? What’s the common practice for this?

Context: I’m starting to use VTK and trying to implement an internal abstraction for mapper/actor generation. Using a common mapper could simplify this process.

vtkDataSetMapper always internally uses a vtkPolyDataMapper. If the input is not a vtkPolyData, it calls a vtkDataSetSurfaceFilter to generate a vtkPolyData that is then getting plugged into a vtkPolyDataMapper. If not, it skips this last step and directly uses the vtkPolyDataMapper.

So you can use a vtkDataSetMapper in all instances.

1 Like

Thanks for the confirmation! Just wanted to make sure before following this path.