2003-2004 Silicon Graphics, Inc.
glGetLight 3G
glGetLight glGetLightfv glGetLightxv return light source parameter values

## C Specification

void `glGetLightfv` GLenum light GLenum pname GLfloat * params void `glGetLightxv` GLenum light GLenum pname GLfixed * params

## Parameters

light

  Specifies a light source. The number of possible lights depends on the implementation, but at least eight lights are supported. They are identified by symbolic names of the form GL_LIGHTi where 0<i< GL_MAX_LIGHTS

pname

  Specifies a light source parameter for light. Accepted symbolic names are `GL_AMBIENT`, `GL_DIFFUSE`, `GL_SPECULAR`, `GL_POSITION`, `GL_SPOT_DIRECTION`, `GL_SPOT_EXPONENT`, `GL_SPOT_CUTOFF`, `GL_CONSTANT_ATTENUATION`, `GL_LINEAR_ATTENUATION`, and `GL_QUADRATIC_ATTENUATION`.

params

  Returns the requested data.

## Description

`glGetLight` returns in params the value or values of a light source parameter. light names the light and is a symbolic name of the form GL_LIGHTi for 0<i< GL_MAX_LIGHTS where `GL_MAX_LIGHTS` is an implementation dependent constant that is greater than or equal to eight. pname specifies one of ten light source parameters, again by symbolic name.

The ten light parameters are defined:

`GL_AMBIENT`

  params returns four fixed-point or floating-point values that specify the ambient RGBA intensity of the light. Both fixed-point and floating-point values are mapped directly. Neither fixed-point nor floating-point values are clamped. The initial ambient light intensity is (0, 0, 0, 1).

`GL_DIFFUSE`

  params returns four fixed-point or floating-point values that specify the diffuse RGBA intensity of the light. Both fixed-point and floating-point values are mapped directly. Neither fixed-point nor floating-point values are clamped. The initial value for `GL_LIGHT0` is (1, 1, 1, 1). For other lights, the initial value is (0, 0, 0, 0).

`GL_SPECULAR`

  params returns four fixed-point or floating-point values that specify the specular RGBA intensity of the light. Both fixed-point and floating-point values are mapped directly. Neither fixed-point nor floating-point values are clamped. The initial value for `GL_LIGHT0` is (1, 1, 1, 1). For other lights, the initial value is (0, 0, 0, 0).

`GL_POSITION`

  params returns four fixed-point or floating-point values representing the position of the light source. Both fixed-point and floating-point values are mapped directly. 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 identity at the time glLight was called. The initial value is (0, 0, 1, 0).

`GL_SPOT_DIRECTION`

  params returns three fixed-point or floating-point values that specify the direction of the light in homogeneous object coordinates. Both fixed-point and floating-point values are mapped directly. Neither fixed-point nor floating-point values are clamped. The initial direction is (0, 0, -1).

`GL_SPOT_EXPONENT`

  params returns a single fixed-point or floating-point value that specifies the intensity distribution of the light. Fixed-point and floating-point values are mapped directly. Only values in the range [0, 128] are accepted. The initial spot exponent is 0.

`GL_SPOT_CUTOFF`

  params returns a single fixed-point or floating-point value that specifies the maximum spread angle of a light source. Fixed-point and floating-point values are mapped directly. Only values in the range [0, 90] and the special value 180 are accepted. If the angle between the direction of the light and the direction from the light to the vertex being lighted is greater than the spot cutoff angle, the light is completely masked. Otherwise, its intensity is controlled by the spot exponent and the attenuation factors. The initial spot cutoff is 180.

`GL_CONSTANT_ATTENUATION`, `GL_LINEAR_ATTENUATION`, `GL_QUADRATIC_ATTENUATION`

  params returns a single fixed-point or floating-point value that specifies one of the three light attenuation factors. Fixed-point 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 times the distance between the light and the vertex being lighted, and the quadratic factor times the square of the same distance. The initial attenuation factors are (1, 0, 0).

## Notes

It is always the case that GL_LIGHTi= GL_LIGHT0+`i`.

If an error is generated, no change is made to the contents of params.

## Errors

`GL_INVALID_ENUM` is generated if light or pname is not an accepted value.

## See Also

glLight

## Copyright

Copyright 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.