The only thing I've used setLocalStateSetModes for is to turn the light
on/off. I've never used setStateSetModes, but it looks like it's just a
convenience function for adding the LightSource's light to the
rootStateSet. Essentially it's including the light for rendering.

If you want to apply a light to selective branches of the scene you would
add the light to the branches stateset, something like this.

osg::StateSet * ss = branch->getOrCreateStateSet();
if (onOff)
{
   ss->setMode(GL_LIGHT0+_light->getLightNum(), osg::StateAttribute::ON);
}
else
{
   ss->setMode(GL_LIGHT0+_light->getLightNum(), osg::StateAttribute::OFF);
}

To turn the light on/off you would turn the lightsource on/off.

lightsource->setLocalStateSetModes(ON/OFF)

Brian

[EMAIL PROTECTED] wrote: -----


To: [email protected]
From: hesicong2006 <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
Date: 02/23/2008 04:47AM
Subject: [osg-users] Question about osg::LightSource

I'm reading osglight.cpp, and in createLights() function where
osg::LightSource(lightS) set StatSet, here are two function:
   lightS1->setLocalStateSetModes(osg::StateAttribute::ON);
   lightS1->setStateSetModes(*rootStateSet,osg::StateAttribute::ON);

My question is what the function of the two StateSetModes, what is the
difference about these two functions? Thanks~~

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

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

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

Reply via email to