I am implementing a custom reader. The reader is derived from vtkAbstractPolyDataReader. When I implement the RequestData function, I specify the points and polys, and I can get the correct geometric. For now, I want set the colors for different part of polys, and I set scalars for different polydata. However, when I load the model, I can’t get the correct color. The problem I found is that, the model use the magnitude of the specific colors. And how to set colors for different polydata in a right way?
The code I used in the custom reader (derived from vtkAbstractPolyDataReader)
vtkPolyData *ply = vtkPolyData::New(); ply->SetPoints(DS->GetOutput()->GetPoints());//set the points ply->SetPolys(DS->GetOutput()->GetPolys());//set the polys ply->GetPointData()->SetScalars(colors);//set the scalar colors [r,g,b]