[vtkusers] Interaction Simultaneous for multiple renderers in one render window

Yang, Jinzhong jinzhong76 at gmail.com
Mon Oct 19 10:29:10 EDT 2009


Hi Jerome,

 

Thank you so much! It works perfectly for my case.

 

-Jinzhong

 

From: Jérôme [mailto:jerome.velut at gmail.com] 
Sent: Monday, October 19, 2009 7:38 AM
To: Yang, Jinzhong
Cc: VTK users group
Subject: Re: [vtkusers] Interaction Simultaneous for multiple renderers in
one render window

 

Hi,
did you try to set the camera of one renderer to the other renderer?
someting like this:
renderer2->SetActiveCamera( renderer1->GetActiveCamera() );

This will do the trick if you use a camera-style interactor.

Hope that helps,
Jerome

2009/10/18 Yang, Jinzhong <jinzhong76 at gmail.com>

Can anybody help me on this?
Thanks.


-----Original Message-----
From: Yang, Jinzhong [mailto:jinzhong76 at gmail.com]
Sent: Friday, October 16, 2009 3:59 PM
To: 'VTK users group'
Subject: Interaction Simultaneous for multiple renderers in one render
window

Hi All,

I have a question on the interaction on the rendered window. Here is a
snippet of my code:

 vtkRenderer* renderer1 = vtkRenderer::New();
 vtkRenderer* renderer2 = vtkRenderer::New();

 vtkRenderWindow* renWin = vtkRenderWindow::New();

 renWin->AddRenderer(renderer1);
 renWin->AddRenderer(renderer2);

 renderer1->SetViewport(0.0, 0.0, 0.5, 1.0);
 renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);

 vtkRenderWindowInteractor* inter = vtkRenderWindowInteractor::New();
 inter->SetRenderWindow(renWin);

 ... (Add mapping data to renderer1 and renderer2)

 // add axes
 vtkAxesActor* axes = vtkAxesActor::New();
 vtkPropAssembly* assembly = vtkPropAssembly::New();
 assembly->AddPart(axes);

 vtkOrientationMarkerWidget* widget1 = vtkOrientationMarkerWidget::New();
 widget1->SetOrientationMarker( assembly );
 widget1->SetInteractor(inter);
 widget1->SetViewport( 0.0, 0.0, 0.2, 0.2 );
 widget1->SetEnabled(1);
 widget1->InteractiveOff();

 renWin->Render();
 inter->Start();

With this code, the object interactions in renderer1 and renderer2 are not
correlated. Here, I would like the interactor (inter) acts simultaneously
for objects in renderer1 and renderer2. For example, when I rotate or zoom
in/out the object in renderer1, the object in renderer2 should change the
same way as object in renderer1 does. Further, with this code, the axis
orientation will change along the object orientation in renderer1, but not
the one in renderer2. However, if I switch the Viewports of renderer1 and
renderer2, the axis orientation will change along the object orientation in
renderer2, but not the one in renderer1. Can anyone give me some hints to
resolve this problem?

Thank you!
-Jinzhong



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK 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/20091019/22d13667/attachment.htm>


More information about the vtkusers mailing list