[vtkusers] Coloring PolyDatas depending on various (externally computed) values
David Doria
daviddoria at gmail.com
Tue Oct 26 10:37:24 EDT 2010
>
> I have tried to set a color (see attached code), but I still need to remove
> the active scalar array ?
>
> Arnaud
>
What you've done there is correct.
A couple of comments:
sphere->GetCellData()->SetScalars( data );
sphere->GetCellData()->SetActiveScalars( "data" );
I believe The second line is redundant. Setting the scalars automatically
sets that array to active.
That is:
sphere->GetCellData()->SetScalars( data );
is equivalent to:
sphere->GetCellData()->AddArray(data );
sphere->GetCellData()->SetActiveScalars( "data" );
Also,
sphere->GetCellData()->SetActiveScalars( "" );
and this:
sphere->GetCellData()->SetActiveScalars(NULL);
I believe do the same thing. In your program, calling either of them turns
off the coloring by 'data'. The color that is displayed is the
SetColor(t,t,t) (which is what I think you want no?).
Last thing - the preferred method of connecting filters is:
mapper->SetInputConnection( sphere->GetOutputPort() );
rather than
mapper->SetInput( sphere );
If I am still missing your problem, please let me know.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101026/bc713f7b/attachment.htm>
More information about the vtkusers
mailing list