[vtk-developers] Actor color gradient
joaoroberto88
joaorobertojr88 at gmail.com
Wed Jun 10 13:16:30 EDT 2015
Hi Devs,
I would like to apply a color gradient on a vtkActor. I've defined scalar
values to each vtkCell (by following this example
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ColorCellsWithRGB).
However, the color transition isn't as I want. Please take a look in the
attached screenshot. Also below is a piece of code responsible for rendering
the image. What can I do to have it done?
Thanks,
Joao.
// Mesh rendering
vtkSmartPointer<vtkPolyData> gridPolyData = mesh->getGrid();
vtkSmartPointer<vtkPolyDataMapper> gridMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
// gridMapper->InterpolateScalarsBeforeMappingOff(); // Didn't take effect
on color gradient
gridMapper->SetInputData(gridPolyData);
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(gridMapper);
// actor->GetProperty()->SetColor(1, 1, 1);
actor->GetProperty()->EdgeVisibilityOff();
renderer = vtkSmartPointer<vtkRenderer>::New();
renderer->SetBackground(1, 1, 1); // White
renderer->AddActor(actor);
renderWindow->AddRenderer(renderer);
// QVTKWidget class method
this->SetRenderWindow(renderWindow);
renderWindow->Render();
<http://vtk.1045678.n5.nabble.com/file/n5732275/Screen_Shot_2015-06-09_at_10.png>
--
View this message in context: http://vtk.1045678.n5.nabble.com/Actor-color-gradient-tp5732275.html
Sent from the VTK - Dev mailing list archive at Nabble.com.
More information about the vtk-developers
mailing list