[vtkusers] vertex colors
Dean Inglis
dean.inglis at sympatico.ca
Tue Jan 9 14:45:17 EST 2007
I have a triangluar surface mesh with
rgba color data associated with each
vertex (point) of the polydata mesh:
vtkDoubleArray* colors = vtkDoubleArray::New();
colors->SetNumberOfComponents(4);
for( int i = 0 i< nverts; i++)
{
colors->SetTuple4(i, r[i], g[i], b[i], o[i] );
}
// where r,g,b,o are double precision red green blue and opacity values
// ranging from 0 - 1
vtkPolyData* surf = vtkPolyData::New();
surf->SetPoints(surfPoints);
surf->SetPolys(surfCells);
surf->GetPointData()->SetScalars(colors);
How do I get the polydata mapper to use these
scalars to color the mesh? Is it...
mapper->SetInput(surf);
mapper->SetScalarVisibilityOn();
? I'm not getting what I expect.
thanks,
Dean
More information about the vtkusers
mailing list