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

Yang, Jinzhong jinzhong76 at gmail.com
Sun Oct 18 15:24:33 EDT 2009


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






More information about the vtkusers mailing list