[vtkusers] layered renderers

Julien greenjava at gmail.com
Thu Apr 10 04:11:42 EDT 2008


Hello,
I had the same problem with multi-layers and interaction. After reading
vtkInteractorStyle source file, I've noticed that interactions apply only on
the "current layer" (dependant on the renderWindow.addRenderer(...) order).
A solution is to create your own override vtkInteractorStyle classe with
multi-layer management.
myInteractorStyle->SetRendererCollection(renderWindow()->GetRenderers());
...
ren->SetInteractorStyle(myInteractorStyle);

Regards,
Julien

2008/4/9, CLEMENTS, ROBERT <rclement at kent.edu>:
>
>  I may have figured this out.  Try setting the interactorstyle on your
> render window with something similar to the following.  If i comment out the
> last 3 lines only 1 of my layers interacts.  See if that helps
>
>
> set iact [[$renderWidget  GetRenderWindow] GetInteractor]
> set renWin2 [$renderWidget GetRenderWindow]
> vtkInteractorStyleTrackballCamera style
> $iact SetInteractorStyle style
> $iact SetRenderWindow $renWin2
> $iact SetDesiredUpdateRate 0
>
>
> Rob
>
>
>
> I tried precisely that. Without success.
> Maybe there is some detail I overlooked.
> DO you have any example-code ?
>
> Kind regards,
> oliver
>
> 2008/4/9, CLEMENTS, ROBERT <rclement at kent.edu>:
> >
> >  I to have had similar problems but  it seems that using something
> similar
> > to below;
> >
> > ren4 SetActiveCamera [ren2 GetActiveCamera]
> >
> > makes both layers react to the same input.  Hope this helps .
> >
> > Rob
> >
> >
> > Hello Steve,
> > I am glad someone else has the same problems to solve ;)
> > However, I fear you are right : The books do not contain any
> > documentation on this. I even searched the archives without success.
> > There is only one rudimentary CPP example.
> > Anyway, I will try to do the same as you are doing and
> > work myself through it. So maybe we can help each other out ?
> >
> > Kind regards,
> > Oliver
> >
> > 2008/4/8, Steve Chall <stevec at renci.org>:
> > >
> > >
> > > >Message: 18
> > > >Date: Tue, 8 Apr 2008 14:12:32 +0200
> > > >From: "Oliver Kania" <ptw.freiburg at googlemail.com>
> > > >Subject: [vtkusers] Multiple rendering layers reacting to interaction
> > > >To: vtkusers at vtk.org
> > > >Message-ID:
> > > >       <e22fb1100804080512q2b1ad655oee6f3581183bfb60 at mail.gmail.com>
> > > >Content-Type: text/plain; charset="iso-8859-1"
> > > >
> > > >Hello,
> > > >my application has several layers :
> > > >
> > > >vtkRenderer RenderImage2 = new vtkRenderer();
> > > >vtkRenderer RenderImage = new vtkRenderer();
> > > >
> > > > RenderImage.SetLayer(0);
> > > > RenderImage2.SetLayer(1);
> > > >
> > > > RenderImage.SetInteractive(1);
> > > > RenderImage2.SetInteractive(1);
> > > >
> > > >
> > > >  RenderImage.SetBackground(0.0, 0.0, 0.3);
> > > >
> > > >  vtkRenderWindow renWin = new vtkRenderWindow();
> > > >  renWin.SetNumberOfLayers(2);
> > > >  renWin.AddRenderer(RenderImage2);
> > > >  renWin.AddRenderer(RenderImage);
> > > >
> > > >vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
> > > >iren.SetRenderWindow(renWin);
> > > >//set image mode interaction style
> > > >vtkInteractorStyleImage interactor = new vtkInteractorStyleImage();
> > > >ren.SetInteractorStyle(interactor);
> > > >
> > > >What I find is that only one layer reacts to interaction.
> > > >Since I used SetInteractive(), I was expecting that both layers do
> > react.
> > > >More generally, I want to have an arbitrary number of layers that do
> > > >react to the same interaction. Maybe it is somehow possible to link
> > > >the cameras of the renderers ?
> > > >(I tried Renderer1.setCamera(Renderer2.getCamera()) but that does
> > > >not work)
> > > >
> > > >kind regards,
> > > >Oliver
> > >
> > > Thank you, Oliver, for bringing layered rendering to my attention.
> This
> > > sounds like it could resolve some visibility issues I'm experiencing.
> > > However, I can't seem to find very much documentation on this
> > > feature.  I've
> > > bought and looked through the books, read the code in vtkRenderer.h,
> and
> > > checked online, and pretty much all I've found out is that layers are
> > > numbered and all but the bottom are transparent.  I can and, if
> > necessary,
> > > will work through it empirically, i.e., by writing code and seeing
> what
> > > happens.  But it would be valuable and probably much more efficient if
> > > there
> > > were some more thorough documentation than what I've found thus far.
> > Can
> > > anyone point me to it?  Admittedly, once again I may have just
> > overlooked
> > > something obvious, but if so I'd appreciate someone shaking me out of
> my
> > > tunnel vision.  Thanks all.
> > >
> > > -Steve
> > >
> > >
> > > _______________________________________________
> > > 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
> > >
> >
> >
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080410/3d473f35/attachment.htm>


More information about the vtkusers mailing list