AW: [vtkusers] Two vtkRenderer in one vtkRenderWindow

Chunyan Jiang jiang at TI.FhG.DE
Fri Jan 24 03:15:45 EST 2003


Hi, Tobi,
Can you control these two renderers at the same time? I mean, whereever your
mouse is , the two render objects will be
rotated or translated together synchronously?


Chunyan
-----Ursprüngliche Nachricht-----
Von: vtkusers-admin at public.kitware.com
[mailto:vtkusers-admin at public.kitware.com]Im Auftrag von Tobias Erne
Gesendet: Donnerstag, 23. Januar 2003 18:51
An: vtkusers at public.kitware.com
Betreff: [vtkusers] Two vtkRenderer in one vtkRenderWindow


Hello everybody,

I'm trying to use two vtkRenderer in one vtkRenderWindow.
I would like to have the second vtkRenderer in the upper left corner.
My problem is, that everything works fine under Linux Red Hat 7.3 but under
Windows 2000 I get only black screen.

Can anyone help me?

Thanks in advance.

Here is my example code.

void main( int argc, char *argv[] )
{
  // create a rendering window and two renderer
  vtkRenderer *ren = vtkRenderer::New();

  vtkRenderer *ren1 = vtkRenderer::New();
  ren1->SetViewport( 0,0.8,0.2,1);

  vtkRenderWindow *renWindow = vtkRenderWindow::New();
  renWindow->AddRenderer(ren);
  renWindow->AddRenderer(ren1);
  renWindow->SetSize( 600, 600 );

  ren->SetBackground(1,1,1);
  ren1->SetBackground(0,0,0);

  // create an actor and give it cone geometry
  vtkCubeSource *cube = vtkCubeSource::New();
  cube->SetBounds(10.0,15.0,10.0,20.0,10.0,20.0);
  vtkPolyDataMapper *cubeMapper = vtkPolyDataMapper::New();
  cubeMapper->SetInput(cube->GetOutput());
  vtkActor *cubeActor = vtkActor::New();
  cubeActor->SetMapper(cubeMapper);
  cubeActor->RotateY(-20.0);

  vtkProperty *prop = vtkProperty::New();
  prop = cubeActor->GetProperty();
  prop->SetColor( 1,0,1);

  ren->AddActor(cubeActor);

  // Interaction
  vtkRenderWindowInteractor *inter = vtkRenderWindowInteractor::New();
  vtkInteractorStyleSwitch* joy = vtkInteractorStyleSwitch::New();
  inter->SetInteractorStyle(joy);

  inter->SetRenderWindow(renWindow);
  inter->Initialize();

  // draw the resulting scene
  renWindow->Render();
  inter->Start();

  // Clean up
  ren->Delete();
  renWindow->Delete();
  cube->Delete();
  cubeMapper->Delete();
  cubeActor->Delete();
  inter->Delete();
}

-Tobi

-------------------------------------------------------
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers




More information about the vtkusers mailing list