[vtkusers] PolyDataMapper colors
David Doria
daviddoria+vtk at gmail.com
Sun Dec 13 11:48:25 EST 2009
> The mapper is ignoring your array because it is not set as the
> "scalars" of the data. You have added an array called "colors" but,
> unless you tell the mapper otherwise, it will assume that this array
> is your own private addition to the data and it will ignore it. The
> name "colors" doesn't have any special value, you could call the array
> "funkytown" just as easily and the results would be the same.
>
> You need to set the color data as the scalars of either the points or
> the cells, you can do this with
> data->GetCellData()->SetScalars(array). To force it to use cell
> scalars, you should call SetScalarModeToUseCellData(). The vtkMapper
> documentation for SetScalarMode() documents this.
>
> David
>
Got it, thanks. It seems to me that a visualization toolkit would know
colors to be a special object. Is there any way we can add a
"SetColors" type function to vtkDataSet to alleviate this type of
confusion?
Thanks,
David
More information about the vtkusers
mailing list