[vtkusers] vtkWindowToImageFilter

zx_sanjin at 163.com zx_sanjin at 163.com
Tue Jan 16 04:57:45 EST 2007


Bingo! xabi, you are great!!

I use another way to do this, it seems better to work:

 vtkRenderWindow* pRenderWindow = pWindow->getRenderWindow();
 vtkRenderer* pRenderer = pRenderWindow->GetRenderers()->GetFirstRenderer();

 pRenderWindow->OffScreenRenderingOn();
 
 vtkRenderLargeImage* pRenderLargeImage = vtkRenderLargeImage::New();
 pRenderLargeImage->SetInput(pRenderer);
 pRenderLargeImage->SetMagnification(1);

 vtkBMPWriter* pBMPWriter = vtkBMPWriter::New();
 pBMPWriter->SetInputConnection(pRenderLargeImage->GetOutputPort());
 pBMPWriter->SetFileName("C:\\ExportRenderWindow2BMP.jpg");

 pWindow->getRenderWindow()->Render();
 pRenderLargeImage->Modified();
 pBMPWriter->Write();

 pRenderLargeImage->Delete();
 pRenderWindow->OffScreenRenderingOff();


It is important for the OffScreenRenderingOn() function, thank xabi again!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070116/2169f5c5/attachment.htm>


More information about the vtkusers mailing list