I can’t seem to get vtkAVIWriter working. I’m making a video of a deforming polygon along with a scalar bar actor. It outputs a black screen and the polygon doesn’t show? Very strange.
I know the camera is positioned correctly and everything works. I know what the results should look like because I previously wrote a version of this with vtkPNGWriter and composited the frames into a video myself. I’m trying to change it to use vtkAVIWriter because it would be easier.
The code is more like a little script just to render this scene, this is how things are more or less setup (some code removed for brevity):
vtkNew<vtkRenderer> ren; ren->AddActor(actor); ren->AddActor2D(scalarBarActor); renWin = vtkSmartPointer<vtkRenderWindow>::New(); renWin->SetSize(2560, 1440); renWin->AddRenderer(ren); vtkNew<vtkRenderWindowInteractor> iren; iren->SetRenderWindow(renWin); vtkNew<vtkCallbackCommand> callback; callback->SetCallback(ExecuteTimerCallback); iren->AddObserver(vtkCommand::TimerEvent, callback); screenshotFilter = vtkSmartPointer<vtkRenderLargeImage>::New(); screenshotFilter->SetInput(ren); screenshotFilter->SetMagnification(1.0); screenshotFilter->Update(); aviWriter = vtkSmartPointer<vtkAVIWriter>::New(); aviWriter->SetFileName("output.avi"); aviWriter->SetQuality(2); aviWriter->SetRate(24); aviWriter->SetInputData(screenshotFilter->GetOutput()); aviWriter->Start(); ren->ResetCamera(); ren->SetBackground(0.6, 0.6, 0.3); renWin->Render(); iren->CreateRepeatingTimer(10); iren->Start(); aviWriter->End();
Then in the callback every ~10ms
...update some things renWin->Render(); screenshotFilter->Update(); aviWriter->Modified(); aviWriter->Write();
It just outputs frames of the scalar bar actor. The background color is not set, and the polygon that corresponds with the mapper and actor in this code is not displayed. Any help would be much appreciated.