Hi Alexandre,

I have some intial finding w.r.t the lighting turning off in the scene
when you use:

   view->setLightingMode(osg::View::NO_LIGHT);

The reason why this unlights the scene, is because the scene graph
setup lacks any enabling of GL_LIGHTING, and it was only visible
because when LightingMode != NO_LIGHT that the internal SceneView
would enable GL_LIGHTING by default.  So not getting any lighting in
the scene is actually correct for the viewer and scene graph setting.
So rather --addslave revealling a bug, it actually makes the code work
as you've set the scene graph/viewer up as.

Adding the following line to osglight.cpp fixes this problem, as it
explicitly enables lighting for the scene you want to light.

   rootnode->getOrCreateStateSet()->setMode(GL_LIGHTING,
osg::StateAttribute::ON);

Now, the question for me is why adding the slave fixes things, and why
without the slave the defaults are having an effect.  It looks like an
order of initialisation issue - i.e. the master camera and it's
Renderer intialize with the defaults of the HEADLIGHT which enables
the GL_LIGHTING mode by default, but the later reset of the
LightingMode to be NO_LIGHT doesn't actively change the GL_LIGHTING
mode/enable disable.   I will continue to look into this, but once I
do fix it the behaviour we should see is that there will be no
lighting enabled by default if you do NO_LIGHT.

I hope this makes sense.

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

Reply via email to