[vtkusers] Changing color of point after selection
Ken Martin
ken.martin at kitware.com
Mon Feb 29 08:27:50 EST 2016
I suspect what is happening is that SetTuple is fast but does not mark the
data as modified. So the rendering engine has no idea you changed the data.
Try calling Modified() on the Scalars after changing its data. That
"should" work, if it doesn't you can try calling Modified() on the
PointData().
Thanks
Ken
On Sun, Feb 28, 2016 at 3:08 PM, kent myers via vtkusers <vtkusers at vtk.org>
wrote:
> Hi,
>
> I have found several posts from the last few years asking basically the
> same
> question that I am asking, and they have not gotten an answer. My
> application is Java, but I think the technique should be the same as for
> C++.
>
> I have created an actor with a vtkPolyDataMapper using output from a
> vtkVertexGlyphFilter using vtkPolyData of vtkPoints. I have created a
> vtkUnsignedCharArray with an entry for each point. Each entry in the array
> is a "short" color triplet of rgb values in range 0 to 255. The
> vtkUnsignedCharArray is assigned to the vtkPolyData object using
> GetPointData().SetScalars(). This renders exactly as expected.
>
> Now I want to change the color of one of the rendered points based on
> selection of the point. I am presently using the SetTuple3 to update the
> selected entry in the vtkUnsignedCharArray with a new color triplet. This
> has no effect. I have also tried calling the
> polyData.GetPointData().SetScalars() with the updated vtkUnsignedCharArray.
> No effect.
>
> I have verified that the array of color triplets is updated by calling
> GetTuple3.
>
> I also tried using double values for the colors using a range of 0 to 255
> and also 0 to 1, and tried assigning a color lookup table to the mapper and
> SetColorModeToMapScalars instead of SetColorModeToDefault. This did not
> work
> either.
>
> Can anyone give me a suggestion about how to change the color of a point
> that already has a color assigned? It doesn't seem like this should be so
> hard to do.
>
> Thanks,
> Kent
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Changing-color-of-point-after-selection-tp5736910.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
>
--
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971
This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee. Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160229/08a015d6/attachment.html>
More information about the vtkusers
mailing list