Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> | |
4 | <refentry id="glGetLight"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glGetLight</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glGetLight</refname> | |
17 | <refpurpose>return light source parameter values</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glGetLightfv</function></funcdef> | |
23 | <paramdef>GLenum <parameter>light</parameter></paramdef> | |
24 | <paramdef>GLenum <parameter>pname</parameter></paramdef> | |
25 | <paramdef>GLfloat * <parameter>params</parameter></paramdef> | |
26 | </funcprototype> | |
27 | </funcsynopsis> | |
28 | <funcsynopsis> | |
29 | <funcprototype> | |
30 | <funcdef>void <function>glGetLightiv</function></funcdef> | |
31 | <paramdef>GLenum <parameter>light</parameter></paramdef> | |
32 | <paramdef>GLenum <parameter>pname</parameter></paramdef> | |
33 | <paramdef>GLint * <parameter>params</parameter></paramdef> | |
34 | </funcprototype> | |
35 | </funcsynopsis> | |
36 | </refsynopsisdiv> | |
37 | <!-- eqn: ignoring delim $$ --> | |
38 | <refsect1 id="parameters"><title>Parameters</title> | |
39 | <variablelist> | |
40 | <varlistentry> | |
41 | <term><parameter>light</parameter></term> | |
42 | <listitem> | |
43 | <para> | |
44 | Specifies a light source. | |
45 | The number of possible lights depends on the implementation, | |
46 | but at least eight lights are supported. | |
47 | They are identified by symbolic names of the form <constant>GL_LIGHT</constant> | |
48 | <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation> | |
49 | where | |
50 | <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation> | |
51 | ranges from 0 to the value of <constant>GL_MAX_LIGHTS</constant> - 1. | |
52 | </para> | |
53 | </listitem> | |
54 | </varlistentry> | |
55 | <varlistentry> | |
56 | <term><parameter>pname</parameter></term> | |
57 | <listitem> | |
58 | <para> | |
59 | Specifies a light source parameter for <parameter>light</parameter>. | |
60 | Accepted symbolic names are | |
61 | <constant>GL_AMBIENT</constant>, | |
62 | <constant>GL_DIFFUSE</constant>, | |
63 | <constant>GL_SPECULAR</constant>, | |
64 | <constant>GL_POSITION</constant>, | |
65 | <constant>GL_SPOT_DIRECTION</constant>, | |
66 | <constant>GL_SPOT_EXPONENT</constant>, | |
67 | <constant>GL_SPOT_CUTOFF</constant>, | |
68 | <constant>GL_CONSTANT_ATTENUATION</constant>, | |
69 | <constant>GL_LINEAR_ATTENUATION</constant>, and | |
70 | <constant>GL_QUADRATIC_ATTENUATION</constant>. | |
71 | </para> | |
72 | </listitem> | |
73 | </varlistentry> | |
74 | <varlistentry> | |
75 | <term><parameter>params</parameter></term> | |
76 | <listitem> | |
77 | <para> | |
78 | Returns the requested data. | |
79 | </para> | |
80 | </listitem> | |
81 | </varlistentry> | |
82 | </variablelist> | |
83 | </refsect1> | |
84 | <refsect1 id="description"><title>Description</title> | |
85 | <para> | |
86 | <function>glGetLight</function> returns in <parameter>params</parameter> the value or values of a light source parameter. | |
87 | <parameter>light</parameter> names the light and is a symbolic name of the form <constant>GL_LIGHT</constant> | |
88 | <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation> | |
89 | where i ranges from 0 to the value of <constant>GL_MAX_LIGHTS</constant> - 1. | |
90 | <constant>GL_MAX_LIGHTS</constant> is an implementation dependent constant that is | |
91 | greater than or equal to eight. | |
92 | <parameter>pname</parameter> specifies one of ten light source parameters, | |
93 | again by symbolic name. | |
94 | </para> | |
95 | <para> | |
96 | The following parameters are defined: | |
97 | </para> | |
98 | <variablelist> | |
99 | <varlistentry> | |
100 | <term><constant>GL_AMBIENT</constant></term> | |
101 | <listitem> | |
102 | <para> | |
103 | <parameter>params</parameter> returns four integer or floating-point values representing the | |
104 | ambient intensity of the light source. | |
105 | Integer values, | |
106 | when requested, | |
107 | are linearly mapped from the internal floating-point representation | |
108 | such that 1.0 maps to the most positive representable integer value, | |
109 | and | |
110 | <inlineequation><mml:math> | |
111 | <!-- eqn: -1.0:--> | |
112 | <mml:mn>-1.0</mml:mn> | |
113 | </mml:math></inlineequation> | |
114 | maps to the most negative representable integer value. | |
115 | If the internal value is outside the range | |
116 | <inlineequation><mml:math> | |
117 | <!-- eqn: [-1,1]:--> | |
118 | <mml:mfenced open="[" close="]"> | |
119 | <mml:mn>-1</mml:mn> | |
120 | <mml:mn>1</mml:mn> | |
121 | </mml:mfenced> | |
122 | </mml:math></inlineequation>, | |
123 | the corresponding integer return value is undefined. The initial value is | |
124 | (0, 0, 0, 1). | |
125 | </para> | |
126 | </listitem> | |
127 | </varlistentry> | |
128 | <varlistentry> | |
129 | <term><constant>GL_DIFFUSE</constant></term> | |
130 | <listitem> | |
131 | <para> | |
132 | <parameter>params</parameter> returns four integer or floating-point values representing the | |
133 | diffuse intensity of the light source. | |
134 | Integer values, | |
135 | when requested, | |
136 | are linearly mapped from the internal floating-point representation | |
137 | such that 1.0 maps to the most positive representable integer value, | |
138 | and | |
139 | <inlineequation><mml:math> | |
140 | <!-- eqn: -1.0:--> | |
141 | <mml:mn>-1.0</mml:mn> | |
142 | </mml:math></inlineequation> | |
143 | maps to the most negative representable integer value. | |
144 | If the internal value is outside the range | |
145 | <inlineequation><mml:math> | |
146 | <!-- eqn: [-1,1]:--> | |
147 | <mml:mfenced open="[" close="]"> | |
148 | <mml:mn>-1</mml:mn> | |
149 | <mml:mn>1</mml:mn> | |
150 | </mml:mfenced> | |
151 | </mml:math></inlineequation>, | |
152 | the corresponding integer return value is undefined. The initial value | |
153 | for <constant>GL_LIGHT0</constant> is (1, 1, 1, 1); for other lights, the | |
154 | initial value is (0, 0, 0, 0). | |
155 | </para> | |
156 | </listitem> | |
157 | </varlistentry> | |
158 | <varlistentry> | |
159 | <term><constant>GL_SPECULAR</constant></term> | |
160 | <listitem> | |
161 | <para> | |
162 | <parameter>params</parameter> returns four integer or floating-point values representing the | |
163 | specular intensity of the light source. | |
164 | Integer values, | |
165 | when requested, | |
166 | are linearly mapped from the internal floating-point representation | |
167 | such that 1.0 maps to the most positive representable integer value, | |
168 | and | |
169 | <inlineequation><mml:math> | |
170 | <!-- eqn: -1.0:--> | |
171 | <mml:mn>-1.0</mml:mn> | |
172 | </mml:math></inlineequation> | |
173 | maps to the most negative representable integer value. | |
174 | If the internal value is outside the range | |
175 | <inlineequation><mml:math> | |
176 | <!-- eqn: [-1,1]:--> | |
177 | <mml:mfenced open="[" close="]"> | |
178 | <mml:mn>-1</mml:mn> | |
179 | <mml:mn>1</mml:mn> | |
180 | </mml:mfenced> | |
181 | </mml:math></inlineequation>, | |
182 | the corresponding integer return value is undefined. The initial value | |
183 | for <constant>GL_LIGHT0</constant> is (1, 1, 1, 1); for other lights, the | |
184 | initial value is (0, 0, 0, 0). | |
185 | </para> | |
186 | </listitem> | |
187 | </varlistentry> | |
188 | <varlistentry> | |
189 | <term><constant>GL_POSITION</constant></term> | |
190 | <listitem> | |
191 | <para> | |
192 | <parameter>params</parameter> returns four integer or floating-point values representing the | |
193 | position of the light source. | |
194 | Integer values, | |
195 | when requested, | |
196 | are computed by rounding the internal floating-point values to the | |
197 | nearest integer value. | |
198 | The returned values are those maintained in eye coordinates. | |
199 | They will not be equal to the values specified using <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>, | |
200 | unless the modelview matrix was identity at the time <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry> was | |
201 | called. The initial value is (0, 0, 1, 0). | |
202 | </para> | |
203 | </listitem> | |
204 | </varlistentry> | |
205 | <varlistentry> | |
206 | <term><constant>GL_SPOT_DIRECTION</constant></term> | |
207 | <listitem> | |
208 | <para> | |
209 | <parameter>params</parameter> returns three integer or floating-point values representing the | |
210 | direction of the light source. | |
211 | Integer values, | |
212 | when requested, | |
213 | are computed by rounding the internal floating-point values to the | |
214 | nearest integer value. | |
215 | The returned values are those maintained in eye coordinates. | |
216 | They will not be equal to the values specified using <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>, | |
217 | unless the modelview matrix was identity at the time <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry> was called. | |
218 | Although spot direction is normalized before being used in the lighting | |
219 | equation, | |
220 | the returned values are the transformed versions of the specified values | |
221 | prior to normalization. The initial value is | |
222 | <inlineequation><mml:math> | |
223 | <!-- eqn: (0, 0, -1):--> | |
224 | <mml:mfenced open="(" close=")"> | |
225 | <mml:mn>0</mml:mn> | |
226 | <mml:mn>0</mml:mn> | |
227 | <mml:mn>-1</mml:mn> | |
228 | </mml:mfenced> | |
229 | </mml:math></inlineequation>. | |
230 | </para> | |
231 | </listitem> | |
232 | </varlistentry> | |
233 | <varlistentry> | |
234 | <term><constant>GL_SPOT_EXPONENT</constant></term> | |
235 | <listitem> | |
236 | <para> | |
237 | <parameter>params</parameter> returns a single integer or floating-point value representing the | |
238 | spot exponent of the light. | |
239 | An integer value, | |
240 | when requested, | |
241 | is computed by rounding the internal floating-point representation to | |
242 | the nearest integer. The initial value is 0. | |
243 | </para> | |
244 | </listitem> | |
245 | </varlistentry> | |
246 | <varlistentry> | |
247 | <term><constant>GL_SPOT_CUTOFF</constant></term> | |
248 | <listitem> | |
249 | <para> | |
250 | <parameter>params</parameter> returns a single integer or floating-point value representing the | |
251 | spot cutoff angle of the light. | |
252 | An integer value, | |
253 | when requested, | |
254 | is computed by rounding the internal floating-point representation to | |
255 | the nearest integer. The initial value is 180. | |
256 | </para> | |
257 | </listitem> | |
258 | </varlistentry> | |
259 | <varlistentry> | |
260 | <term><constant>GL_CONSTANT_ATTENUATION</constant></term> | |
261 | <listitem> | |
262 | <para> | |
263 | <parameter>params</parameter> returns a single integer or floating-point value representing the | |
264 | constant (not distance-related) attenuation of the light. | |
265 | An integer value, | |
266 | when requested, | |
267 | is computed by rounding the internal floating-point representation to | |
268 | the nearest integer. The initial value is 1. | |
269 | </para> | |
270 | </listitem> | |
271 | </varlistentry> | |
272 | <varlistentry> | |
273 | <term><constant>GL_LINEAR_ATTENUATION</constant></term> | |
274 | <listitem> | |
275 | <para> | |
276 | <parameter>params</parameter> returns a single integer or floating-point value representing the | |
277 | linear attenuation of the light. | |
278 | An integer value, | |
279 | when requested, | |
280 | is computed by rounding the internal floating-point representation to | |
281 | the nearest integer. The initial value is 0. | |
282 | </para> | |
283 | </listitem> | |
284 | </varlistentry> | |
285 | <varlistentry> | |
286 | <term><constant>GL_QUADRATIC_ATTENUATION</constant></term> | |
287 | <listitem> | |
288 | <para> | |
289 | <parameter>params</parameter> returns a single integer or floating-point value representing the | |
290 | quadratic attenuation of the light. | |
291 | An integer value, | |
292 | when requested, | |
293 | is computed by rounding the internal floating-point representation to | |
294 | the nearest integer. The initial value is 0. | |
295 | </para> | |
296 | </listitem> | |
297 | </varlistentry> | |
298 | </variablelist> | |
299 | </refsect1> | |
300 | <refsect1 id="notes"><title>Notes</title> | |
301 | <para> | |
302 | It is always the case that <constant>GL_LIGHT</constant> | |
303 | <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation> | |
304 | = <constant>GL_LIGHT0</constant> + | |
305 | <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>. | |
306 | </para> | |
307 | <para> | |
308 | If an error is generated, | |
309 | no change is made to the contents of <parameter>params</parameter>. | |
310 | </para> | |
311 | </refsect1> | |
312 | <refsect1 id="errors"><title>Errors</title> | |
313 | <para> | |
314 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>light</parameter> or <parameter>pname</parameter> is not an | |
315 | accepted value. | |
316 | </para> | |
317 | <para> | |
318 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glGetLight</function> | |
319 | is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> | |
320 | and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. | |
321 | </para> | |
322 | </refsect1> | |
323 | <refsect1 id="seealso"><title>See Also</title> | |
324 | <para> | |
325 | <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry> | |
326 | </para> | |
327 | </refsect1> | |
328 | <refsect1 id="Copyright"><title>Copyright</title> | |
329 | <para> | |
330 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
331 | Silicon Graphics, Inc. This document is licensed under the SGI | |
332 | Free Software B License. For details, see | |
333 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
334 | </para> | |
335 | </refsect1> | |
336 | </refentry> |