View Full Version : Directional light's direction with GetLight()?
09-15-2001, 07:26 AM
According to the (section 6.1.3) spec, a GetLight() call with a value of position returns the light's position in eye space coordinates. Is this true for directional lights too? Shouldn't it return the light's direction in eye space? I would think that I would want to get (x,y,z) of the light position transformed by the top-left 3x3 inverse-transpose model-view matrix. Instead, according to the spec, it seem that the would get (x,y,z,w=0) of the light position transformed by the 4x4 model-view matrix.
09-15-2001, 08:02 AM
The params parameter returns three integer or floating-point values representing the direction of the light source. Integer values, when requested, are computed by rounding the internal floating-point values to the nearest integer value. The returned values are those maintained in eye coordinates. They will not be equal to the values specified using glLight, unless the modelview matrix was identified at the time glLight was called. Although spot direction is normalized before being used in the lighting equation, the returned values are the transformed versions of the specified values prior to normalization.
09-16-2001, 02:56 PM
Isn't that for the spotlight direction? The direction for a directional light is stored in the light position and indicated by setting the w-component to zero. Only the direction for a spot light would be returned by calling GetLight() with a value of Spot_Direction. (right?) I would expect the direction for a directional light to be returned by calling GetLight() with a value of Position.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.