[vtkusers] Easy vtkPlaneSource coloring question

Theodore Sternberg tdsternberg at lbl.gov
Thu Jan 20 16:25:53 EST 2005


I'm trying to produce a 2x3 array of colored rectangles.

===================================
scalars = vtkDoubleArray()
scalars.SetNumberOfTuples(6)
for i in range(0,6):
    scalars.SetTuple1(i,i)
plane = vtkPlaneSource()
plane.SetResolution(1,2)
plane.Update()
plane.GetOutput().GetPointData().SetScalars(scalars)
[The rest is standard mapper, renderwindow, renderer stuff]
===================================

Instead of the hoped-for 2x3 array of colored rectangles, I get a 1x2 
array, colored according to just the first two of my scalar values.  
That's with the mapper set to "flat" interpolation.  If I set the mapper 
to Gouraud interpolation, I can see the full range of scalar values.

Why is this, and how can I see all my scalar values without going to 
Goraud interpolation?

Ted Sternberg
Lawrence Berkeley National Laboratory





More information about the vtkusers mailing list