[vtkusers] Re: Question about mixing 2d and 3d actors again...
Roger Blum
roger_blum at swissonline.ch
Wed Oct 11 06:52:31 EDT 2006
Hi Anja,
I had the same problem a couple of week ago. This is what helped in my case:
I had to eplicitly use the SetTransformCoordinate of the mapper object. I am
using Tcl, but you probably can try the same in C++:
# Create a vtkCoordinate object and set the coordinate systrem to world
coordinates
set worldCoords [vtkCoordinate rapWorldCoord]
$worldCoords SetCoordinateSystemToWorld
...
# Create a 2D mapper and set its transform coordinate
set mapper2DSymbol [vtkPolyDataMapper2D rapPDM2]
$mapper2DSymbol SetTransformCoordinate $worldCoords
HTH,
Roger
"Anja Ende" <anja.ende at googlemail.com> schrieb im Newsbeitrag
news:1f5d2b4f0610110333r317ea8e7g3ec93905646fde41 at mail.gmail.com...
Hi everyone,
I was wondering if anyone has successfully displayed a 3d actor over a 2d
actor and be willing to share an example.
I tried but unsuccessfully... I am only either able to show the 3d actor
that is scaled and my 2d actor is not visible or I see nothing at all. I
tried setting camera stuff (especially with parallel projection) but did
not really work. I guess I am shooting in the dark here...
I am trying to do something simple like:
// Add our 2d actor
this->m_renderer->AddActor(this->m_actor2D);
vtkPNGReader * cursorImage = vtkPNGReader::New();
cursorImage->SetFileName("/home/anja/bin/crosshair.png");
cursorImage->Update();
vtkImageActor * actor = vtkImageActor::New();
actor->SetInput(cursorImage->GetOutput());
actor->PickableOn();
// Add the 3d actor.
this->m_renderer->AddActor(actor);
actor->Delete();
cursorImage->Delete();
// As per David's suggestion.
this->m_actor2D->GetProperty()->SetDisplayLocationToBackground();
this->m_renderer->GetActiveCamera()->ParallelProjectionOn();
Hope you can help me. Thanks again :)
I will keep trying and update this thread when this is solved. I think a lot
of newbies like me are struggling with this.
Cheers,
Anja
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list