[vtkusers] Re: question about vtkActors

David Gobbi dgobbi at atamai.com
Tue Oct 10 15:55:38 EDT 2006


Hi Anja,

I think that you are just seeing some of the 2D actors being hidden by 
other 2D actors.  It's always possible to mix 2D and 3D actors in VTK 
(although 2D and 3D actors don't use the same coordinate system of course).

The vtkProperty2D class has these methods for controlling whether your 
2D actor appears in front of or behind the 3D actors in the scene:

  SetDisplayLocationToForeground();
  SetDisplayLocationToBackground();

If you have several 2D actors, you can control which 2D actors appear in 
front of other 2D actors by assigning them to different "layers", e.g.

actor1->SetLayerNumber(0);
actors->SetLayerNumber(1);

 - David



Anja Ende wrote:
> Ok, another thing I noticed is that the 2d and 3d actors do not 
> co-exist within the same renderer.
>
> I have something like:
>
> vtkPNGReader * Image = vtkPNGReader::New();
> Image->SetFileName("/home/anja/image.png");
> Image->Update();
> vtkImageActor * actor = vtkImageActor::New();
> actor->SetInput(Image->GetOutput());
> actor->PickableOn();
>
> Now, I am adding 2 actors to the renderer as:
>
> // 2d actor
> this->m_renderer->AddActor(this->m_actor2D);
> and...
> this->m_renderer->AddActor(actor);
>
> All I see on the screen is my huge image (scaled) and not the 
> underlying 2D actor now...
>
> Is it not at all possible to control these aspects of 3d actors? For 
> example, I do not want the actor to interpolate. I have a reslicer 
> which does the interpolation and I do not want to interpolate again... 
> Is it not possible to turn it these things off or have an easy way to 
> position these actors?? Quite confusing....
>
> Cheers,
> Anja
>
> On 10/10/06, *Anja Ende* <anja.ende at googlemail.com 
> <mailto:anja.ende at googlemail.com>> wrote:
>
>     Hi everyone,
>
>     I have been trying to convert all my 2D actors to vtkActor as I
>     just cannot seem to get the prop picking to work.
>
>     However, I am having a really hard time getting the actors to be
>     placed where I want them to be:
>
>     In particular, 2 affects are really annoying:
>
>     - The actor seems to scale itself to fill the view. I guess it
>     wants to place itself in such a way that all other actors are
>     visible. Is there a way to override it. I do not want my images to
>     be scaled!
>
>     - Second is the positioning of the actor. Can I simply specify an
>     x, y screen position and the actor places itself at that point or
>     is it completely hopeless and I need to redo half the rendering
>     engine of vtk? :P
>
>     By the way, anyone knows what is going on with the search today? I
>     only am getting blank pages back.
>
>     Thanks. I hope someone can help me.
>
>     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