[vtkusers] How to change Points color

Alex Malyushytsky malyushytsky at gmail.com
Mon Mar 23 19:16:57 EDT 2015


There are multiple ways to specify color.
I suggest you to check examplex at:
http://vtk.org/Wiki/VTK/Examples

Just search for color on the page.
You can for example to specify 1 color for your actor as below:

actor->GetProperty()->SetColor(1,0,0);


On Mon, Mar 23, 2015 at 10:50 AM, ferluduena <xpelaox at gmail.com> wrote:

> 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.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150323/1f7881b9/attachment.html>


More information about the vtkusers mailing list