[osg-users] creating a light following camera

Robert Osfield robert.osfield at gmail.com
Tue Jan 1 04:38:38 PST 2008


On Dec 31, 2007 5:05 AM, Yanling Liu <vrnova at gmail.com> wrote:
> Hi, could you please help me to create a light following camera, such as a
> head light? Thanks!

The osgViewer::Viewer already by default creates a light that works as
a headlight.

If you wish to disable this feature via
View(er)::setLightingMode(osg::View::NO_LIGHT); then you create the
same effect by placing a osg::LightSource in the scene graph and set
its ReferenceFrame to ABSOLUTE_RF so that its modelview matrix
is initialized to identity placing the attached light relative to the
eye/camera coordinate frame.

Robert.


More information about the osg-users mailing list