[vtkusers] Color an actor

Gib Bogle g.bogle at auckland.ac.nz
Thu Oct 7 02:01:15 EDT 2010


This must have a very simple answer.  I am creating a mapper (tileMapper) to 
render a polygon, using the same code as in the Wiki example polygon.cxx.  I 
expect to be able to set the color when I create an actor:

double tileColor[] = {0.5, 0.5, 0.0};
actor = vtkActor::New();
actor->SetMapper(tileMapper);
actor->GetProperty()->SetColor(tileColor);

but it doesn't work.  The tile always displays with the color that was set when 
the PolyData used by tileMapper was created:

polygonPolyData->GetCellData()->SetScalars(colors);

The method I'm using (unsuccessfully) to set the color is the same I use with 
other mappers, created using vtkSphereSource, for example.

How should I be doing it?



More information about the vtkusers mailing list