[vtkusers] Changing colors?

Koning, P.J.H. de (LKEB) P.J.H.de_Koning at lumc.nl
Thu Sep 19 05:32:36 EDT 2002

18-09-02 20:41:50, Jeremy Winston <winston at cat.rpi.edu> wrote:

Maybe you need to set the ScalarRange. The default range is between 0 and 1 (I think). If your scalars are outside that range, you will only see 1 color.

>    I was hoping to change the scalar values associated
>with the points in the vtkPolyData output by vtkMarchingSquares, 
>and to have those changed values affect the color of the actor
>associated with that data.
>    I'm doing something wrong.  No matter how I fiddle with the
>scalars, the actor always appears the same shade of blue.
>Here is a code snippet:
>  vtkMarchingSquares vhdContour
>    [...]
>  vtkPolyDataMapper2D vhdContMapper
>    vhdContMapper SetInput [vhdContour GetOutput]
>  vtkActor2D vhdContActor
>    vhdContActor SetMapper vhdContMapper
>  vtkRenderer ren1
>  vtkRenderWindow renWin
>    renWin AddRenderer ren1
>  ren1 AddActor2D vhdContActor
>And I have been trying to get/set the scalars thusly:
>  [[vhdContour GetOutput] GetPointData] GetComponent 0 0
>  [[vhdContour GetOutput] GetPointData] SetComponent 0 0 12
>Though the scalar values are being changed, the color remains the same.
>Any hints will be greatly appreciated.
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:

More information about the vtkusers mailing list