diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index 1c9c3be4b..b9f20f4ea 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -99,7 +99,7 @@ namespace MWRender osg::ref_ptr lightManager = new SceneUtil::LightManager; lightManager->setStartLight(1); - osg::ref_ptr stateset = new osg::StateSet; + osg::ref_ptr stateset = lightManager->getOrCreateStateSet(); stateset->setMode(GL_LIGHTING, osg::StateAttribute::ON); stateset->setMode(GL_NORMALIZE, osg::StateAttribute::ON); stateset->setMode(GL_CULL_FACE, osg::StateAttribute::ON); @@ -130,7 +130,6 @@ namespace MWRender lightSource->setStateSetModes(*stateset, osg::StateAttribute::ON); - lightManager->setStateSet(stateset); lightManager->addChild(lightSource); mCamera->addChild(lightManager);