forked from mirror/openmw-tes3mp
freeze screen during screenshot taking
This commit is contained in:
parent
1ab854446c
commit
823218bb61
1 changed files with 10 additions and 0 deletions
|
@ -890,6 +890,13 @@ namespace MWRender
|
|||
|
||||
mRootNode->addChild(rttCamera);
|
||||
|
||||
rttCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
GLbitfield maskBackup = mViewer->getCamera()->getClearMask();
|
||||
double clearDepthBackup = mViewer->getCamera()->getClearDepth();
|
||||
mViewer->getCamera()->setClearMask(GL_DEPTH_BUFFER_BIT);
|
||||
mViewer->getCamera()->setClearDepth(0);
|
||||
|
||||
// The draw needs to complete before we can copy back our image.
|
||||
osg::ref_ptr<NotifyDrawCompletedCallback> callback (new NotifyDrawCompletedCallback);
|
||||
rttCamera->setFinalDrawCallback(callback);
|
||||
|
@ -907,6 +914,9 @@ namespace MWRender
|
|||
// now that we've "used up" the current frame, get a fresh framenumber for the next frame() following after the screenshot is completed
|
||||
mViewer->advance(mViewer->getFrameStamp()->getSimulationTime());
|
||||
|
||||
mViewer->getCamera()->setClearMask(maskBackup);
|
||||
mViewer->getCamera()->setClearDepth(clearDepthBackup);
|
||||
|
||||
rttCamera->removeChildren(0, rttCamera->getNumChildren());
|
||||
mRootNode->removeChild(rttCamera);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue