Hi Werner,

The way that OpenGL lighting works is that the direction for an
infinite light is controlled by the position which is a vec4, with the
last element set to 0 for a infinite light..  The direction parameter
is only relevant for things like spot lights.  I'd recommend reading
up on OpenGL lighting to understand all of the deatils, the OSG just
wraps this up.

Robert.

On 7/26/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


What I basically did, was after the view initialization, I access the
osgUtil::SceneView functions to set the global lighting of my scene (not
adding it to the scenegraph as in the osgLight example).

As a part of my viewer initialization code, I do the following:

  m_SceneView->setDefaults();

  m_SceneView->setLightingMode(osgUtil::SceneView::SKY_LIGHT);

  m_WorldLight = m_SceneView->getLight();
  m_WorldLight->setDirection(osg::Vec3d(0.0, 1.0, 0.0));

That's it. And the direction of the global light is still the default (0.0,
0.0, -1.0)...


The second question here is what would be the "best practice" of
manipulating the lighting in a scene? Adding the light nodes as in the
osgLight example, or using these SceneView funcitons to manipulate the
lights?

Regards, Werner Lindgård.






             "Robert Osfield"
             <[EMAIL PROTECTED]
             mail.com>                                                  To
             Sent by:                  "osg users"
             osg-users-bounces         <[email protected]>
             @openscenegraph.n                                          cc
             et
                                                                   Subject
                                       Re: [osg-users] Applying
             26.07.2006 09:58          directional lighting in OSG


             Please respond to
                 osg users
             <[EMAIL PROTECTED]
               enegraph.net>





HI Werner,

The OSG will apply lights for you an each new frame as part of the
RenderStage set up.

Its difficult to comment on what you what be amiss on what you are
doing with so little detail.  The best I can do is point you in the
direction of the osglight example.

Robert.

On 7/26/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Hello.
>
> In my scene I have set up the SceneView to use SKY_LIGHT with
> setLightingMode().
> I also have access to the osg::Light object form the SceneView, but when
> changing the direction or material of the light, nothing really changes
in
> the rendering.
>
> Do I need to use the apply() funciton on the light? If so, which State am
I
> going to use? (Not to familiar with that part yet)...
>
> Regards, Werner Lindgård.
>
>
> _______________________________________________
> Werner Lindgård, Programmerer
> Telephone   +47 67 81 70 00
> Direct line     +47 67 81 70 68
> [EMAIL PROTECTED]
>
> ViaNova Systems AS
> Leif Tronstads Plass 4, P.O.Box 434
> N-1302 Sandvika, Norway
> ________________________________________________
>
> http://www.vianova.no
> http://www.novapoint.com
>
> ________________________________________________
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to