[vtkusers] How to create multi-render?

tony s986292 at mailserv.cuhk.edu.hk
Tue Mar 27 12:41:00 EST 2001


Hello,

    I want to write a VTK program with multi-render in C++. But only the last one render (ren4) can display, others render is totoally black.
Does anybody know why?

Tony Chung

My code.
-------------------------------------------------------------
void main( int argc, char *argv[] )
{

 int i;
  // create a rendering window and both renderers
 renWin = vtkRenderWindow::New();
 vtkRenderer *ren1 = vtkRenderer::New();   // main window
 renWin->AddRenderer(ren1);
 vtkRenderer *ren2 = vtkRenderer::New();   // sub-win 1
    renWin->AddRenderer(ren2);
 vtkRenderer *ren3 = vtkRenderer::New();   // sub-win 2
    renWin->AddRenderer(ren3);
 vtkRenderer *ren4 = vtkRenderer::New();   // sub-win 3
    renWin->AddRenderer(ren4);
 
 iren = vtkRenderWindowInteractor::New();
 iren->SetRenderWindow(renWin);


 // read the volume
  v16 = vol_reader();
  // ********* create a b/w lookup table *************
  bwLut = bw_table();
c = 32;
  // ********* create coronal plane ******************
  coronal = cor_plane(v16,c,bwLut);
  coronal->PickableOff();
a = 32;
  // ********* create axial plane ********************
  axial  = axi_plane(v16,a,bwLut);
  axial->PickableOff();
s = 32;
  // ********* create sagittal plane *****************
  sagittal= sag_plane(v16,s,bwLut);
  sagittal->PickableOff();

  /**************************************************************/
 

  // assign our actor to both renderers
 ren1->AddActor(sagittal);
 ren1->AddActor(axial);
 ren1->AddActor(coronal);
 
 ren2->AddActor(axial);
 ren3->AddActor(sagittal);
 ren4->AddActor(coronal);

  // set the size of our window
 renWin->SetSize(600,300);

  vtkCamera *aCamera = vtkCamera::New();
  aCamera->SetViewUp (0, 0, -1);
  aCamera->SetPosition (0, 10, 0);
  aCamera->SetFocalPoint (0, 0, 0);
  aCamera->ComputeViewPlaneNormal();
  
  ren1->SetActiveCamera(aCamera);
  ren1->ResetCamera ();
  aCamera->Dolly(1.5);
  ren1->ResetCameraClippingRange();

  // set the viewports and background of the renderers
 ren1->SetViewport(0,0,0.6,1);
 ren2->SetViewport(0.6,0,1,0.33);
 ren3->SetViewport(0.6,0.33,1,0.66);
 ren4->SetViewport(0.6,0.66,1,1);

 ren1->SetBackground(0.2,0.3,0.5);
 ren2->SetBackground(0.2,0.5,0.3);
 ren3->SetBackground(0.4,0.2,0.1);
 ren4->SetBackground(0.3,0.7,0.6);

  // draw the resulting scene
 renWin->Render();
//_beginthread((void(*)(void*))updateplane,STACK_SIZE,NULL);


  // make one view 90 degrees fromother
 //ren1->GetActiveCamera()->Azimuth(90);
 picker = vtkCellPicker::New();
 iren->SetPicker(picker);
 iren->SetEndPickMethod( &annotatePick, (void *)NULL );
 iren->Start();


  // Clean up
 ren1->Delete();
 ren2->Delete();
 ren3->Delete();
 ren4->Delete();
 renWin->Delete();
 
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010328/a5d69a40/attachment.htm>


More information about the vtkusers mailing list