[vtkusers] Getting offscreen render window displayed on the monitor when exporting an image.
Jenya Burstein
taijinian at gmail.com
Thu Aug 4 18:39:58 EDT 2011
Hello All,
I have a small pipeline that exports a PNG image ( see code below) . The
problem is that a window with a black background comes up on the screen and
then goes away. Is it possible to output an image in hardware supported
offscreen mode without getting render window show up on the monitor?
Any advice is greatly appreciated,
Jenya
void exportVTKPlotImage(vtkRenderWindow& renderWindow) const
{
vtkSmartPointer<vtkRenderWindow> localRenderWindow = v
tkSmartPointer<vtkRenderWindow>::New();
localRenderWindow->OffScreenRenderingOn();
localRenderWindow->SetSize(2048, 1024);
vtkSmartPointer<vtkRenderer> renderer =
renderWindow.GetRenderers()->GetFirstRenderer();
localRenderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter =
vtkSmartPointer<vtkWindowToImageFilter>::New();
windowToImageFilter->SetInput(localRenderWindow);
vtkSmartPointer<vtkPNGWriter> pngWriter =
vtkSmartPointer<vtkPNGWriter>::New();
pngWriter->SetInputConnection(windowToImageFilter->GetOutputPort());
pngWriter->SetFileName("export.png");
pngWriter->Write();
localRenderWindow->RemoveRenderer(renderer);
renderer->SetRenderWindow(&renderWindow);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110804/2496a947/attachment.htm>
More information about the vtkusers
mailing list