[vtkusers] Changing color of point after selection

kent myers dakota_63124 at yahoo.com
Sun Feb 28 15:08:17 EST 2016


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.


More information about the vtkusers mailing list