Hi,

Try adding your osg::Light to a StateSet, i.e. (pseudocode)

group = osg::Group()
lightsource = osg::LightSource()
light = osg::Light()
light.setLightNum(0)
....
lightsource.setLight(light)
group.addChild(lightsource)
group.getOrCreateStateSet().setAttribute(light, osg::StateAttribute::ON)

viewer.setSceneData(group)

It seems StateAttribute callbacks are only called when the attribute is set on a StateSet. Setting the light as state attribute on "lightsource" does not seem to work, which is a bit surprising as a osg::LightSource is a Group and therefore also has a StateSet. Actually, I find the whole Light / LightSource (which is a Group) / Light set as a StateAttribute a bit confusing.

Paul


Vincent Bourdier wrote:
Hi,

I just need to move a light, and for that I try to use a callback.
So I implement a simple class lightMoveCallback : public osg::StateAttribute::Callback

with virtual void operator()(osg::StateAttribute* ss, osg::NodeVisitor* nv);

but the callback is never called...

I use :
light->setUpdateCallback(new lightMoveCallback())
thanks for help,

Regards,
Vincent.
------------------------------------------------------------------------

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

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

Reply via email to