Hi Jannik,

I've had a look at the SceneView::inheritCullSettings and
SceneView::setLightingMode() methods and only the later looks to
modify the globalStateSet.  If I've missed something else let me know.
>From my reading of the code it should be OK to change
SceneView::setLightingMode() to modify the _secondaryStateSet when
it's available rather than the _globalStateSet.

~/OpenSceneGraph/src/osgUtil$ svn diff
Index: SceneView.cpp
===================================================================
--- SceneView.cpp       (revision 14894)
+++ SceneView.cpp       (working copy)
@@ -597,15 +597,17 @@
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 @@
    {
        #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
    }


This should mean that when a Master + Slave Camera combination is used
the SceneView::setLightingMode() will modify the Slave Camera StateSet
not the shared Master Camera's StateSet.  This change is now checked
into svn/trunk.

Could you try out this modification, whilst reverting the change you
made to Renderer.cpp.

Thanks,
Robert
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to