1GLGETLIGHT(3G) GLGETLIGHT(3G)
2
3
4
6 glGetLightfv, glGetLightiv - return light source parameter values
7
8
10 void glGetLightfv( GLenum light,
11 GLenum pname,
12 GLfloat *params )
13 void glGetLightiv( GLenum light,
14 GLenum pname,
15 GLint *params )
16
17
19 light Specifies a light source. The number of possible lights
20 depends on the implementation, but at least eight lights are
21 supported. They are identified by symbolic names of the form
22 GL_LIGHTi where 0 ≤ i < GL_MAX_LIGHTS.
23
24 pname Specifies a light source parameter for light. Accepted sym‐
25 bolic names are GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR,
26 GL_POSITION, GL_SPOT_DIRECTION, GL_SPOT_EXPONENT,
27 GL_SPOT_CUTOFF, GL_CONSTANT_ATTENUATION, GL_LINEAR_ATTENUATION,
28 and GL_QUADRATIC_ATTENUATION.
29
30 params Returns the requested data.
31
33 glGetLight returns in params the value or values of a light source
34 parameter. light names the light and is a symbolic name of the form
35 GL_LIGHTi for 0 ≤ i < GL_MAX_LIGHTS, where GL_MAX_LIGHTS is an imple‐
36 mentation dependent constant that is greater than or equal to eight.
37 pname specifies one of ten light source parameters, again by symbolic
38 name.
39
40 The following parameters are defined:
41
42 GL_AMBIENT params returns four integer or floating-point val‐
43 ues representing the ambient intensity of the light
44 source. Integer values, when requested, are lin‐
45 early mapped from the internal floating-point rep‐
46 resentation such that 1.0 maps to the most positive
47 representable integer value, and -1.0 maps to the
48 most negative representable integer value. If the
49 internal value is outside the range [-1, 1], the
50 corresponding integer return value is undefined.
51 The initial value is (0, 0, 0, 1).
52
53 GL_DIFFUSE params returns four integer or floating-point val‐
54 ues representing the diffuse intensity of the light
55 source. Integer values, when requested, are lin‐
56 early mapped from the internal floating-point rep‐
57 resentation such that 1.0 maps to the most positive
58 representable integer value, and -1.0 maps to the
59 most negative representable integer value. If the
60 internal value is outside the range [-1, 1], the
61 corresponding integer return value is undefined.
62 The initial value for GL_LIGHT0 is (1, 1, 1, 1);
63 for other lights, the initial value is (0, 0, 0,
64 0).
65
66 GL_SPECULAR params returns four integer or floating-point val‐
67 ues representing the specular intensity of the
68 light source. Integer values, when requested, are
69 linearly mapped from the internal floating-point
70 representation such that 1.0 maps to the most posi‐
71 tive representable integer value, and -1.0 maps to
72 the most negative representable integer value. If
73 the internal value is outside the range [-1, 1],
74 the corresponding integer return value is unde‐
75 fined. The initial value for GL_LIGHT0 is (1, 1, 1,
76 1); for other lights, the initial value is (0, 0,
77 0, 0).
78
79 GL_POSITION params returns four integer or floating-point val‐
80 ues representing the position of the light source.
81 Integer values, when requested, are computed by
82 rounding the internal floating-point values to the
83 nearest integer value. The returned values are
84 those maintained in eye coordinates. They will not
85 be equal to the values specified using glLight,
86 unless the modelview matrix was identity at the
87 time glLight was called. The initial value is (0,
88 0, 1, 0).
89
90 GL_SPOT_DIRECTION params returns three integer or floating-point val‐
91 ues representing the direction of the light source.
92 Integer values, when requested, are computed by
93 rounding the internal floating-point values to the
94 nearest integer value. The returned values are
95 those maintained in eye coordinates. They will not
96 be equal to the values specified using glLight,
97 unless the modelview matrix was identity at the
98 time glLight was called. Although spot direction
99 is normalized before being used in the lighting
100 equation, the returned values are the transformed
101 versions of the specified values prior to normal‐
102 ization. The initial value is (0, 0, -1).
103
104 GL_SPOT_EXPONENT params returns a single integer or floating-point
105 value representing the spot exponent of the light.
106 An integer value, when requested, is computed by
107 rounding the internal floating-point representation
108 to the nearest integer. The initial value is 0.
109
110 GL_SPOT_CUTOFF params returns a single integer or floating-point
111 value representing the spot cutoff angle of the
112 light. An integer value, when requested, is com‐
113 puted by rounding the internal floating-point rep‐
114 resentation to the nearest integer. The initial
115 value is 180.
116
117 GL_CONSTANT_ATTENUATION
118 params returns a single integer or floating-point
119 value representing the constant (not distance-
120 related) attenuation of the light. An integer
121 value, when requested, is computed by rounding the
122 internal floating-point representation to the near‐
123 est integer. The initial value is 1.
124
125 GL_LINEAR_ATTENUATION
126 params returns a single integer or floating-point
127 value representing the linear attenuation of the
128 light. An integer value, when requested, is com‐
129 puted by rounding the internal floating-point rep‐
130 resentation to the nearest integer. The initial
131 value is 0.
132
133 GL_QUADRATIC_ATTENUATION
134 params returns a single integer or floating-point
135 value representing the quadratic attenuation of the
136 light. An integer value, when requested, is com‐
137 puted by rounding the internal floating-point rep‐
138 resentation to the nearest integer. The initial
139 value is 0.
140
142 It is always the case that GL_LIGHTi = GL_LIGHT0 + i.
143
144 If an error is generated, no change is made to the contents of params.
145
147 GL_INVALID_ENUM is generated if light or pname is not an accepted
148 value.
149
150 GL_INVALID_OPERATION is generated if glGetLight is executed between the
151 execution of glBegin and the corresponding execution of glEnd.
152
154 glLight(3G)
155
156
157
158 GLGETLIGHT(3G)