PDA

View Full Version : Point Lights



jordiperez
09-30-2002, 03:16 AM
Hi all,

I need to render my scene with a PointLight with Attenuation (LINEAR_ATTENUATION for exemple).

Can someone guide me to get the source code running to acomplish it??

Thanks.

JML
09-30-2002, 03:19 AM
Check out the documentation for the glLight() function call:


void glLightf(
GLenum light,
GLenum pname,
GLfloat param
);
...
pname
GL_CONSTANT_ATTENUATION
GL_LINEAR_ATTENUATION
GL_QUADRATIC_ATTENUATION
The params parameter is a single integer or floating-point value that specifies one of the three light attenuation factors. Integer and floating-point values are mapped directly. Only nonnegative values are accepted. If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of: the constant factor, the linear factor multiplied by the distance between the light and the vertex being lighted, and the quadratic factor multiplied by the square of the same distance. The default attenuation factors are (1,0,0), resulting in no attenuation.
...

HTH

Jean-Marc