From 7f634514a833ce346a4b2077593fd15e482779b7 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 19 Jul 2017 17:43:15 +0200 Subject: [PATCH] Fix the viewport of the character preview being set a frame ahead due to a threading issue --- apps/openmw/mwrender/characterpreview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index b0899f47eb..877c35bba1 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -254,7 +254,10 @@ namespace MWRender sizeX = std::max(sizeX, 0); sizeY = std::max(sizeY, 0); - mCamera->setViewport(0, mSizeY-sizeY, std::min(mSizeX, sizeX), std::min(mSizeY, sizeY)); + // NB Camera::setViewport has threading issues + osg::ref_ptr stateset = new osg::StateSet; + stateset->setAttributeAndModes(new osg::Viewport(0, mSizeY-sizeY, std::min(mSizeX, sizeX), std::min(mSizeY, sizeY))); + mCamera->setStateSet(stateset); redraw(); }