File: light.3gl

package info (click to toggle)
vnc4 4.1.1%2BX4.3.0-37
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 171,636 kB
  • ctags: 288,245
  • sloc: ansic: 2,205,268; cpp: 56,345; sh: 38,092; pascal: 13,773; asm: 12,656; tcl: 9,182; lisp: 7,831; perl: 3,364; makefile: 2,957; yacc: 2,902; objc: 2,698; xml: 2,614; python: 2,383; lex: 1,477; awk: 901; csh: 58; sed: 50
file content (253 lines) | stat: -rw-r--r-- 8,748 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
'\" te
'\"! tbl|eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 light.gl 
.ds Xs 33725 10 light.gl
.TH GLLIGHT 3G
.SH NAME
.B "glLightf, glLighti, glLightfv, glLightiv
\- set light source parameters

.SH C SPECIFICATION
void \f3glLightf\fP(
GLenum \fIlight\fP,
.nf
.ta \w'\f3void \fPglLightf( 'u
	GLenum \fIpname\fP,
	GLfloat \fIparam\fP )
.fi
void \f3glLighti\fP(
GLenum \fIlight\fP,
.nf
.ta \w'\f3void \fPglLighti( 'u
	GLenum \fIpname\fP,
	GLint \fIparam\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\fIparams\fP\ \ 'u 
\f2light\fP
Specifies a light.
The number of lights depends on the implementation,
but at least eight lights are supported.
They are identified by symbolic names of the form \%\f3GL_LIGHT\fP$i$
where 0 \(<= $ i $ < \%\f3GL_MAX_LIGHTS\fP.
.TP
\f2pname\fP
Specifies a single-valued light source parameter for \f2light\fP.
\%\f3GL_SPOT_EXPONENT\fP,
\%\f3GL_SPOT_CUTOFF\fP,
\%\f3GL_CONSTANT_ATTENUATION\fP,
\%\f3GL_LINEAR_ATTENUATION\fP, and
\%\f3GL_QUADRATIC_ATTENUATION\fP are accepted.
.TP
\f2param\fP
Specifies the value that parameter \f2pname\fP of light source \f2light\fP
will be set to.
.SH C SPECIFICATION
void \f3glLightfv\fP(
GLenum \fIlight\fP,
.nf
.ta \w'\f3void \fPglLightfv( 'u
	GLenum \fIpname\fP,
	const GLfloat \fI*params\fP )
.fi
void \f3glLightiv\fP(
GLenum \fIlight\fP,
.nf
.ta \w'\f3void \fPglLightiv( 'u
	GLenum \fIpname\fP,
	const GLint \fI*params\fP )
.fi

.SH PARAMETERS
.TP
\f2light\fP
Specifies a light.
The number of lights depends on the implementation, but
at least eight lights are supported.
They are identified by symbolic names of the form \%\f3GL_LIGHT\fP$i$
where 0 \(<= $ i $ < \%\f3GL_MAX_LIGHTS\fP.
.TP
\f2pname\fP
Specifies a light source parameter for \f2light\fP.
\%\f3GL_AMBIENT\fP,
\%\f3GL_DIFFUSE\fP,
\%\f3GL_SPECULAR\fP,
\%\f3GL_POSITION\fP,
\%\f3GL_SPOT_CUTOFF\fP,
\%\f3GL_SPOT_DIRECTION\fP,
\%\f3GL_SPOT_EXPONENT\fP,
\%\f3GL_CONSTANT_ATTENUATION\fP,
\%\f3GL_LINEAR_ATTENUATION\fP, and
\%\f3GL_QUADRATIC_ATTENUATION\fP are accepted.
.TP
\f2params\fP
Specifies a pointer to the value or values that parameter \f2pname\fP
of light source \f2light\fP will be set to.
.SH DESCRIPTION
\%\f3glLight\fP sets the values of individual light source parameters.
\f2light\fP names the light and is a symbolic name of the form \%\f3GL_LIGHT\fP$i$,
where 0 \(<= i < \%\f3GL_MAX_LIGHTS\fP.
\f2pname\fP specifies one of ten light source parameters,
again by symbolic name.
\f2params\fP is either a single value or a pointer to an array that contains
the new values.
.P
To enable and disable lighting calculation, call \%\f3glEnable\fP
and \%\f3glDisable\fP with argument \%\f3GL_LIGHTING\fP. Lighting is
initially disabled.
When it is enabled,
light sources that are enabled contribute to the lighting calculation.
Light source $i$ is enabled and disabled using \%\f3glEnable\fP and
\%\f3glDisable\fP with argument \%\f3GL_LIGHT\fP$i$. 
.P
The ten light parameters are as follows:
.TP 20
\%\f3GL_AMBIENT\fP
\f2params\fP contains four integer or floating-point values that specify
the ambient RGBA intensity of the light.
Integer values are mapped linearly such that the most positive representable
value maps to 1.0,
and the most negative representable value maps to \-1.0.
Floating-point values are mapped directly.
Neither integer nor floating-point values are clamped.
The initial ambient light intensity is (0, 0, 0, 1).
.TP
\%\f3GL_DIFFUSE\fP
\f2params\fP contains four integer or floating-point values that specify
the diffuse RGBA intensity of the light.
Integer values are mapped linearly such that the most positive representable
value maps to 1.0,
and the most negative representable value maps to \-1.0.
Floating-point values are mapped directly.
Neither integer nor floating-point values are clamped.
The initial value
for \%\f3GL_LIGHT0\fP is (1, 1, 1, 1); for other lights, the
initial value is (0, 0, 0, 0). 
.TP
\%\f3GL_SPECULAR\fP
\f2params\fP contains four integer or floating-point values that specify
the specular RGBA intensity of the light.
Integer values are mapped linearly such that the most positive representable
value maps to 1.0,
and the most negative representable value maps to \-1.0.
Floating-point values are mapped directly.
Neither integer nor floating-point values are clamped.
The initial value
for \%\f3GL_LIGHT0\fP is (1, 1, 1, 1); for other lights, the
initial value is (0, 0, 0, 0). 
.TP
\%\f3GL_POSITION\fP
\f2params\fP contains four integer or floating-point values that specify
the position of the light in homogeneous object coordinates.
Both integer and floating-point values are mapped directly.
Neither integer nor floating-point values are clamped.
.IP
The position is transformed by the modelview matrix when
\%\f3glLight\fP is called (just as if it were a point),
and it is stored in eye coordinates.
If the $w$ component of the position is 0,
the light is treated as a directional source.
Diffuse and specular lighting calculations take the light's direction,
but not its actual position,
into account,
and attenuation is disabled.
Otherwise,
diffuse and specular lighting calculations are based on the actual location
of the light in eye coordinates,
and attenuation is enabled.
The initial position is (0, 0, 1, 0);
thus, the initial light source is directional,
parallel to, and in the direction of the $-z$ axis.
.TP
\%\f3GL_SPOT_DIRECTION\fP
\f2params\fP contains three integer or floating-point values that specify
the direction of the light in homogeneous object coordinates.
Both integer and floating-point values are mapped directly.
Neither integer nor floating-point values are clamped.
.IP
The spot direction is transformed by the inverse of the modelview matrix when
\%\f3glLight\fP is called (just as if it were a normal),
and it is stored in eye coordinates.
It is significant only when \%\f3GL_SPOT_CUTOFF\fP is not 180,
which it is initially.
The initial direction is (0, 0, \-1).
.TP
\%\f3GL_SPOT_EXPONENT\fP
\f2params\fP is a single integer or floating-point value that specifies
the intensity distribution of the light.
Integer and floating-point values are mapped directly.
Only values in the range [0,128] are accepted.
.IP
Effective light intensity is attenuated by the cosine of the angle between
the direction of the light and the direction from the light to the vertex
being lighted,
raised to the power of the spot exponent.
Thus, higher spot exponents result in a more focused light source,
regardless of the spot cutoff angle (see \%\f3GL_SPOT_CUTOFF\fP, next paragraph).
The initial spot exponent is 0,
resulting in uniform light distribution.
.TP
\%\f3GL_SPOT_CUTOFF\fP
\f2params\fP is a single integer or floating-point value that specifies
the maximum spread angle of a light source.
Integer 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.
.BP
Otherwise, its intensity is controlled by the spot exponent and the
attenuation factors.
The initial spot cutoff is 180,
resulting in uniform light distribution.
.TP
\%\f3GL_CONSTANT_ATTENUATION\fP
.TP
\%\f3GL_LINEAR_ATTENUATION \fP
.TP
\%\f3GL_QUADRATIC_ATTENUATION\fP
\f2params\fP 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 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),
resulting in no attenuation.
.SH NOTES
It is always the case that \%\f3GL_LIGHT\fP$i$ = \%\f3GL_LIGHT0\fP + $i$.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if either \f2light\fP or \f2pname\fP
is not an accepted value.
.P
\%\f3GL_INVALID_VALUE\fP is generated if a spot exponent value is specified
outside the range [0,128],
or if spot cutoff is specified outside the range [0,90] (except for the
special value 180),
or if a negative attenuation factor is specified.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glLight\fP is executed between
the execution of
\%\f3glBegin\fP and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGetLight\fP
.br
\%\f3glIsEnabled\fP with argument \%\f3GL_LIGHTING\fP
.SH SEE ALSO
\%\f3glColorMaterial(3G)\fP,
\%\f3glLightModel(3G)\fP,
\%\f3glMaterial(3G)\fP