Hi JS,

osg::View  by default has a head light so you could just use this, or
if you wish to use a LightSource in the scene graph then use the
LightSource::setReferenceFrame(osg::LightSource::ABSOLUTE_RF) to put
the light source in eye coordinates.

Robert.

On Mon, Dec 8, 2008 at 8:36 PM, Jean-Sébastien Guay
<[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Quick question. Say I want to make a headlight (like the light source that's
> added to the viewer by default if no lights are in the model), where should
> I add it in my graph?
>
> Say I have a single view with a single camera, I tried adding an osg::Light
> to the camera's stateset. That doesn't work, the light seems to be in a
> fixed position at all times, even if I move the camera around.
>
> Do I need a callback to explicitly change my light to match the view
> direction each frame? I don't think the viewer needs that, I think it
> happens automatically, because I can't find any code related to that... Then
> again, the only code I can find related to the headlight is in
> SceneView.cpp, where it says:
>
>    if (_light.valid())
>        renderStage->addPositionedAttribute(NULL,_light.get());
>
> Not sure how I can do something equivalent from outside viewer code...
>
> Can anyone offer some guidance please? Thanks in advance,
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay    [EMAIL PROTECTED]
>                               http://www.cm-labs.com/
>                        http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to