[vtkusers] How to change Points color

ferluduena xpelaox at gmail.com
Mon Mar 23 13:50:52 EDT 2015


Hi All,

Hope you can help me, i'm sure there is a very simple and straightforward
way of changing the color of a point cloud. First of all, this is my code:

            vtkPolyData pointsPolydata = new vtkPolyData();
            pointsPolydata.SetPoints(Ptos);
            vtkVertexGlyphFilter vertexFilter = new vtkVertexGlyphFilter();
           
vertexFilter.SetInputConnection(pointsPolydata.GetProducerPort());
            vertexFilter.Update();
            vtkPolyData polydata = new vtkPolyData();
            polydata.ShallowCopy(vertexFilter.GetOutput());
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
            mapper.SetInput(polydata);
            vtkActor actor = new vtkActor();
            actor.SetMapper(mapper);
            vtkRenderWindow RenderWindow =
renderWindowControl2.RenderWindow;
            // get a reference to the renderer
            vtkRenderer renderer =
RenderWindow.GetRenderers().GetFirstRenderer();
            // set background color
            renderer.SetBackground(0.2, 0.3, 0.4);
            // add actor to the renderer
            renderer.AddActor(actor);

            // ensure all actors are visible (in this example not
necessarely needed,
            // but in case more than one actor needs to be shown it might be
a good idea)

            renderer.ResetCamera();

Ptos is a vtkPoints where i have a stored a cloud of points.

This code draws what i've generated, in white. My idea is to insert several
times different objects on a same Render Window, so i need it to be able of
using a different color for each set of points.

How can i achieve this?

Thanks a lot in advance.



--
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-change-Points-color-tp5731114.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list