Hi Robert,
The osg::LightSource node is a positional state node - it binds the attached osg::Light to a position in space. The OpenGL light can be enabled/disabled for other subgraphs just via stateset->setMode(GL_LIGHT0+lightNum, osg::StateAttribute::ON); The osglight example illustrates this.
I was wondering about this the other day: I would like to be able to turn lights (osg::Lights) on and off, keep them in the scene graph but not have them take a light ID (which we have only 8 of in the fixed pipeline).
* I've made a Light ID manager but having multiple lights in the graph with the same ID is not a good idea (never really sure which one wins out).
* I've tried setting the light ID to -1 but that gives repeated "invalid attribute" OpenGL errors.
* I tried removing the osg::Light from the osg::LightSource (storing it in a separate ref_ptr and doing ls->setLight(0)) but that led to crashes (I think osg::LightSource is not meant to exist without a Light).
* I can't set the lightSource's node mask to 0 because I have a NodeCallback on that node that checks if light parameters changed (like whether it's on or not) and updates itself, so if I set its node mask to 0 the callback won't ever be called so I won't be able to turn it back on. I could rearrange things so that the callback is on a group with the LightSource as child, though.
So I was wondering if you had suggestions about how to do what I want. Or is the LightSource just designed to be in the graph when the light is active and removed when it's not? (that wouldn't work for me either because of the callback)
Thanks in advance, J-S -- ______________________________________________________ Jean-Sebastien Guay [email protected] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

