[vtkusers] Re: help highlighting actor

Andrew Wilford andrew at artwork.com
Mon Dec 20 11:54:41 EST 2004


Luis,

This is how I select an actor with a mouse click:

vtkPropPicker *picker = vtkPropPicker::New();
if(picker->PickProp(x, y, m_Renderer) == 1) {
  vtkActor *actor = (vtkActor*)picker->GetProp();
}
picker->Delete();

m_Renderer is the member renderer in use and you would substitute your
renderer here. If you wanted to highlight any actor with the mouse over
event, you could have the picker be a member variable as well, to avoid
construction/deletion over and over as you move the mouse.

As far as highlighting, I remember there being a way to draw a bounding box
around the actor, but I don't remember the function name. I didn't like this
method, so instead I modified the actor's property to a highlight color.

Hope this helps.

Andrew Wilford




More information about the vtkusers mailing list