vtkXOpenGLRenderWindow: window appears in off-screen rendering mode
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Tests were performed on Red Hat 5.5 (64bit) with VTK 5.6.1.
I've tried to enable the off-screen rendering mode on both Windows & Linux platforms with vtkRenderWindow::SetOffScreenRendering() method. While it works properly on Windows, the blank rendering window is surprisingly displayed on Linux.
Here is my sample code:
========================================================================== vtkSmartPointer aRenderWindow = vtkSmartPointer::New(); vtkSmartPointer aRenderer = vtkSmartPointer::New(); aRenderWindow->AddRenderer(aRenderer);
aRenderWindow->SetOffScreenRendering(1); aRenderWindow->SetSize(600, 600);
vtkSmartPointer aCamera = aRenderer->GetActiveCamera(); aCamera->ParallelProjectionOn(); aCamera->SetPosition(1.0, 1.0, 1.0); aRenderer->ResetCamera();
vtkSmartPointer anActor = vtkSmartPointer::New(); vtkSmartPointer aMapper = vtkSmartPointer::New(); vtkSmartPointer aSphereSource = vtkSmartPointer::New(); aMapper->SetInput( aSphereSource->GetOutput() ); anActor->SetMapper(aMapper); aRenderer->AddActor(anActor);
vtkSmartPointer aPNGWriter = vtkSmartPointer::New(); vtkSmartPointer aWinToImageFilter = vtkSmartPointer::New();
aWinToImageFilter->SetInput(aRenderWindow); aWinToImageFilter->SetInputBufferTypeToRGB(); aWinToImageFilter->SetMagnification(1); aWinToImageFilter->ShouldRerenderOn(); aWinToImageFilter->Update();
aPNGWriter->SetInput( aWinToImageFilter->GetOutput() ); aPNGWriter->SetFileName("sphere_output.png"); aPNGWriter->Write();
It seems like there is a problem in vtkXOpenGLRenderWindow, line #643 (closed):
================================================= if(this->OwnWindow) { ... XMapWindow(this->DisplayId, this->WindowId); ...
This code is executed even in the off-screen rendering mode. I've used the following patch to prevent the window from mapping:
================================================= if(this->OwnWindow !this->OffScreenRendering) { ... XMapWindow(this->DisplayId, this->WindowId); ...
I resolves the problem with the blank window. Do you think it is possible to apply that patch on future versions of VTK?