I wanna add a head light into the scene, ie.,the light is always attched with 
camera.

For adding a light source into the scene, there are two different ways as i 
know:

1 using osg::LightSource::  setLight method

 
osg::LightSource* ls = new osg::LightSource;
ls->setLight(new osg::Light(0));
ls->setReferenceFrame(osg::LightSource::ABSOLUTE_RF);
geode->setStateSet(ls->getOrCreateStateSet());


2 using setAttribute method

ls->getOrCreateStateSet()->setAttribute(new osg::Light(0));
geode->setStateSet(ls->getOrCreateStateSet());


I think two different ways should give the same result. Actually, they are 
different.

No. 1 Method:  the light behaves like directional light, but not head light.

No.2 method:  just like head light.


who could tell me why the two ways are different?
which is correct?






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

Reply via email to