Hi David, On 30 October 2012 08:17, Daniel Schmid <[email protected]> wrote: > I struggle to add a light to my viewer. I have the sky light illuminating > the scene (light 0). Now I want to add a spotlight to illuminate the area > right in front of my camera for night scenarios. I tried to attach the light > to the scene and position it in a cull visitor in front of the viewer… but > is there no way to attach the light directly to the camera node so that it > is moved along with the camera? Anybody can give me some example code?
osg::View has settings for the light position - either a sky light in world coords, or a headlight in eye coords. Have a look a include/osg/View. osgViewer::Viewer inherits from osg::View (via osgViewer::View) so you'll get all these methods. The other alternative is to use an osg::LightSource placed in the scene graph as set the ReferenceFrame to ABSOLUTE_RF. Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

