[vtkusers] Help with vtkActor2D picking

Dejan Zivkovic dejan.zivkovic90 at gmail.com
Mon Jun 6 09:44:09 EDT 2016


I have some problems with picking vtkActor2D. Part of the code that
constructs actor2D is here:

vtkSmartPointer<vtkPNGReader> pngReader =
vtkSmartPointer<vtkPNGReader>::New();
pngReader->SetFileName(filename.c_str());
pngReader->Update();


vtkSmartPointer<vtkImageMapper> imageMapper =
vtkSmartPointer<vtkImageMapper>::New();
imageMapper->SetInputConnection(pngReader->GetOutputPort());
imageMapper->Update();

imageActor = vtkSmartPointer<vtkActor2D>::New();
imageActor->SetMapper(imageMapper);
imageActor->GetProperty()->SetOpacity(1.0);
imageActor->SetPickable(true);

I use vtkActor2D::SetPosition(...) to set the actor position on the sceen
and the image
really moves where I position it.

The problem is in picking (using vtkPropPicker). The actors image on
the screen doesn't react on picking, but when I click near the bottom left
corner
of the screen (screen coordinates near zero), the propPicker detects that
picked actor.

So, the actor2D seems to be in screen origin, regardless of which position
I set
using vtkActor2D::SetPosition(), but its image is moved as it should.

Do you have any idea why?

Thanks,
Dejan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160606/c540066d/attachment.html>


More information about the vtkusers mailing list