vtkSmartPointer<vtkWindowToImageFilter> wif =
vtkSmartPointer<vtkWindowToImageFilter>::New();
wif->SetInput(window);// wif.SetMagnification(2);// wif.SetInputBufferTypeToRGBA(); // also record the alpha// wif.ReadFrontBufferOff(); // read from the back buffer
wif->Update();staticint index =0;
QString name ="screen_"+QString::number(index)+".jpg";
vtkSmartPointer<vtkJPEGWriter> writer =
vtkSmartPointer<vtkJPEGWriter>::New();
writer->SetFileName(name.toStdString().c_str());
writer->SetInputConnection(wif->GetOutputPort());
writer->Write();