From ffbd3a32033eec2faa5e835d46a1168962bf37ae Mon Sep 17 00:00:00 2001 From: Shekhar Chandra Home Windows Date: Tue, 1 Mar 2016 09:10:30 +1000 Subject: [PATCH] Fixed issue with screenshot crash on Windows. Also happens on Mac, seems to be related to off-screen rendering. --- src/Qt/milxQtMain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Qt/milxQtMain.cpp b/src/Qt/milxQtMain.cpp index 9597aea..d231054 100644 --- a/src/Qt/milxQtMain.cpp +++ b/src/Qt/milxQtMain.cpp @@ -861,13 +861,15 @@ void milxQtMain::saveScreen(QString filename) return; //Ensure GUI doesnt interfere - windowVTK->GetRenderWindow()->OffScreenRenderingOn(); +// windowVTK->GetRenderWindow()->StereoRenderOff(); +// windowVTK->GetRenderWindow()->OffScreenRenderingOn(); // windowVTK->GetRenderWindow()->SetAlphaBitPlanes(1); //Use alpha channel windowVTK->GetRenderWindow()->Render(); windowToImage->SetInput(windowVTK->GetRenderWindow()); windowToImage->SetMagnification(magnifyFactor); // windowToImage->SetInputBufferTypeToRGBA(); //also record the alpha (transparency) channel + windowToImage->ReadFrontBufferOff(); windowToImage->Update(); if(filename.isEmpty()) @@ -887,7 +889,7 @@ void milxQtMain::saveScreen(QString filename) printDebug("Screenshot Size: " + QString::number(extent[1]-extent[0]) + ", " + QString::number(extent[3]-extent[2]) + ", " + QString::number(extent[5]-extent[4])); bool success = writer->saveImage(filename, windowToImage->GetOutput()); - windowVTK->GetRenderWindow()->OffScreenRenderingOff(); +// windowVTK->GetRenderWindow()->OffScreenRenderingOff(); windowVTK->GetRenderWindow()->Render(); //Restore rendering if(!success)