From ceabbdb8d9621be351bf4b0257b8b1260f6e0b6f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 8 Jun 2015 10:20:53 +0000 Subject: [PATCH] Addressed race condition where SceneView::setLightingMode() was setting a shread Master Camera's StateSet. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14898 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgUtil/SceneView.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index 3340f61e9..f757913ec 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -597,15 +597,17 @@ void SceneView::computeRightEyeViewport(const osg::Viewport *viewport) void SceneView::setLightingMode(LightingMode mode) { if (mode==_lightingMode) return; + + osg::StateSet* stateSetToModify = _secondaryStateSet.valid() ? _secondaryStateSet.get() : _globalStateSet.get(); if (_lightingMode!=NO_SCENEVIEW_LIGHT) { // remove GL_LIGHTING mode - _globalStateSet->removeMode(GL_LIGHTING); + stateSetToModify->removeMode(GL_LIGHTING); if (_light.valid()) { - _globalStateSet->removeAssociatedModes(_light.get()); + stateSetToModify->removeAssociatedModes(_light.get()); } } @@ -616,10 +618,10 @@ void SceneView::setLightingMode(LightingMode mode) { #if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) // add GL_LIGHTING mode - _globalStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON); + stateSetToModify->setMode(GL_LIGHTING, osg::StateAttribute::ON); if (_light.valid()) { - _globalStateSet->setAssociatedModes(_light.get(), osg::StateAttribute::ON); + stateSetToModify->setAssociatedModes(_light.get(), osg::StateAttribute::ON); } #endif }