[vtkusers] help needed setting up the colormap/lookuptable/mapper in C++
David, John
john.david at uconn.edu
Mon Aug 13 07:48:02 EDT 2007
> You could use vtkDoubleArray or vtkFloatArray to set up the scalars:
>
> vtkDoubleArray *scalars = vtkDoubleArray::New();
> for (i=0; !in.eof() && in.good(); i++)
> {
> in >> v;
> scalars.InsertNextValue(v);
> }
> polyData->SetScalars(scalars);
Hmmm... That gives me a compile error:
'class vtkPolyData' has no member named 'SetScalars'
I thought that maybe I had to go through a PolyDataMapper, but that did not work as well.
Poking around a little I found that the SetScalars method is defined in vtkDataSetAttributes.h, vtkMergeFilter.h, and ./vtkSampleFunction.h. Do I have to set up a merge filter to set the scalers? Any other suggestions?
BTW, I defined the polyData and mapper as follows:
vtkPolyData *polyData = vtkPolyData::New();
vtkPolyDataMapper *aMapper = vtkPolyDataMapper::New();
More information about the vtkusers
mailing list