[vtkusers] Actor color gradient
joaoroberto88
joaorobertojr88 at gmail.com
Wed Jun 10 13:09:00 EDT 2015
Hello,
I've posted this topic in VTK Users list, but I think this one is more
active from the first (sorry for the duplicity of subjects). Here is my
problem:
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/n5732273/Screen_Shot_2015-06-09_at_10.png>
--
View this message in context: http://vtk.1045678.n5.nabble.com/Actor-color-gradient-tp5732273.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list