MantisBT - VTK
View Issue Details
0011912VTK(No Category)public2011-03-01 08:112013-06-05 16:10
Sergey Slyadnev 
Jean-Christophe Fillion-Robin 
normalminoralways
closedfixed 
 
5.10.1 
0011912: vtkXOpenGLRenderWindow: blank window appears in off-screen rendering mode
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<vtkRenderWindow> aRenderWindow =
  vtkSmartPointer<vtkRenderWindow>::New();
vtkSmartPointer<vtkRenderer> aRenderer =
  vtkSmartPointer<vtkRenderer>::New();
aRenderWindow->AddRenderer(aRenderer);

aRenderWindow->SetOffScreenRendering(1);
aRenderWindow->SetSize(600, 600);

vtkSmartPointer<vtkCamera> aCamera = aRenderer->GetActiveCamera();
aCamera->ParallelProjectionOn();
aCamera->SetPosition(1.0, 1.0, 1.0);
aRenderer->ResetCamera();

vtkSmartPointer<vtkActor> anActor = vtkSmartPointer<vtkActor>::New();
vtkSmartPointer<vtkPolyDataMapper> aMapper =
  vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkSphereSource> aSphereSource =
  vtkSmartPointer<vtkSphereSource>::New();
aMapper->SetInput( aSphereSource->GetOutput() );
anActor->SetMapper(aMapper);
aRenderer->AddActor(anActor);

vtkSmartPointer<vtkPNGWriter> aPNGWriter =
  vtkSmartPointer<vtkPNGWriter>::New();
vtkSmartPointer<vtkWindowToImageFilter> aWinToImageFilter =
  vtkSmartPointer<vtkWindowToImageFilter>::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 0000643:

=================================================
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?
No tags attached.
related to 0011911closed Jean-Christophe Fillion-Robin vtkXOpenGLRenderWindow: window appears in off-screen rendering mode 
Issue History
2011-03-01 08:11Sergey SlyadnevNew Issue
2013-06-05 16:08Jean-Christophe Fillion-RobinRelationship addedrelated to 0011911
2013-06-05 16:09Jean-Christophe Fillion-RobinAssigned To => Jean-Christophe Fillion-Robin
2013-06-05 16:09Jean-Christophe Fillion-RobinStatusbacklog => tabled
2013-06-05 16:09Jean-Christophe Fillion-RobinNote Added: 0030919
2013-06-05 16:10Jean-Christophe Fillion-RobinNote Added: 0030920
2013-06-05 16:10Jean-Christophe Fillion-RobinStatustabled => closed
2013-06-05 16:10Jean-Christophe Fillion-RobinResolutionopen => fixed
2013-06-05 16:10Jean-Christophe Fillion-RobinFixed in Version => 5.10.1

Notes
(0030919)
Jean-Christophe Fillion-Robin   
2013-06-05 16:09   
Updated test case: http://www.vtk.org/Bug/view.php?id=11911#c30917 [^]
(0030920)
Jean-Christophe Fillion-Robin   
2013-06-05 16:10   
Off screen rendering has been tested using VTK 6 (384636ec) and VTK 5.10.1 on Ubuntu 10.04 using the provided testcase and it works as expected.