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
This commit is contained in:
Robert Osfield 2015-06-08 10:20:53 +00:00
parent f7f1487fca
commit ceabbdb8d9

View File

@ -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
}