[vtkusers] I have modified my code, but it does not work for rendering a 3d image in a loop

LuanKuan luankuan at hotmail.com
Tue Nov 9 22:59:37 EST 2010


Hi, vtk users

I am a beginner. 
 
I just want to render a 3d image in the same vtkRenderWindow without creating a new one.
 
I create vtkrenderer and vtkrenderwindow before the loop.
 
The 3d image is updated and rendered in the loop.
 
I have modified my code, but the 3d image is not rendered after it updated.
 
My code is as fellows, please give me some advices.
 
thank you.

 
 vtkRenderer *aRenderer = vtkRenderer::New();
 vtkRenderWindow *renWin = vtkRenderWindow::New();
 renWin->AddRenderer(aRenderer);
 vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
 iren->SetRenderWindow(renWin);
 
 vtkContourFilter *contours = vtkContourFilter::New();
 contours->SetInput(volumeimage);
 contours->SetValue(0,gval);

 vtkPolyDataMapper *contmap = vtkPolyDataMapper::New();
 contmap->SetInput(contours->GetOutput());
 contmap->SetScalarRange(100,220);

 vtkActor *contact = vtkActor::New();
 contact->SetMapper(contmap);
 aRenderer->AddActor(contact);
 
 vtkCamera *aCamera = vtkCamera::New();
 aCamera->ParallelProjectionOn();
 aRenderer->SetActiveCamera(aCamera);
 aRenderer->ResetCamera();
 aRenderer->SetBackground(0.725,0.725,1);
 renWin->SetSize(1024, 768);
 aRenderer->ResetCameraClippingRange ();
 renWin->Render();
 iren ->Initialize();

// loop 
for (int i=iFirstFrame; i<iNumFrames; i++)
{
  ......
  interpolate bmpimage into volumeimage;
  ......
  volumeimage->update();
  aRenderer->Render();
  renWin->Render();
  iren->Render();
}
iren->Start();

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101110/caf210c9/attachment.htm>


More information about the vtkusers mailing list