Greetings.

The direction of DirectionalLights is opposite to what I expected, and opposite 
to the behavior of SpotLights -- at least in OpenSG 1.8.  I've been tracing 
through the logic, and here's what I've figured out:

>From the OpenGL documentation:

   http://www.opengl.org/sdk/docs/man/

   "If the w component of the position is 0, the light is treated as
    a directional source ...  The initial position is (0, 0, 1, 0);
    thus, the initial light source is directional, parallel to, and
    in the direction of the -z axis."

So the direction is opposite to the GL_POSITION, and conversely, the 
GL_POSITION is opposite to the direction, and the GL_SPOT_DIRECTION is ignored.

But in OpenSG 1.8 DirectionalLight::drawEnter(Action *action) I see:

   Vec4f dir(_sfDirection.getValue());

   dir[3] = 0;
    
   glLightfv(light, GL_POSITION   , dir.getValues());
   glLightf (light, GL_SPOT_CUTOFF, 180.f          );

So it's setting the GL_POSITION from the specified direction, instead of its 
opposite.  The direction is pointing toward the light, instead of away from it 
as with the SpotLight.  I suppose it would break a lot of client code, but I 
would change one line:

   glLightfv(light, GL_POSITION   , (-dir).getValues());
   
Thoughts?

Does OpenSG 2.0 follow the same logic?

Thanks for your attention.

-- 

Ted

------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to