nv50: fix build-predicate function
[mesa.git] / docs / subset-A.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>Mini GLX Specification</title>
5 </head>
6 <body>
7 <span style="font-style: italic;"></span><span
8 style="font-weight: bold;"></span>
9 <h1>
10 <center>Mesa Subset Specification</center>
11 </h1>
12 <h2>
13 <center>
14 <h3>Tungsten Graphics, Inc.</h3>
15 <h3>February 26, 2003<br>
16 </h3>
17 </center>
18 </h2>
19 <p> Copyright &copy; 2002-2003 by <a
20 href="http://www.tungstengraphics.com/">Tungsten Graphics, Inc.</a>,
21 Cedar Park, Texas. All Rights Reserved. <br>
22 <br>
23 Permission is granted to make and distribute verbatim copies of this
24 document provided the copyright notice and this permission notice are
25 preserved on all copies.<br>
26 </p>
27 <p> OpenGL is a trademark of <a href="http://www.sgi.com">Silicon
28 Graphics, Inc.</a>.</p>
29 <h1>1. Introduction</h1>
30 This document describes a subset of the Mesa implemented by Tungsten
31 Graphics, Inc. for embedded devices. &nbsp;Prior to reading this
32 document the reader should be familiar with the OpenGL 1.2.1
33 specification dated April 1, 1999 (available from <a
34 href="http://www.opengl.org/developers/documentation/specs.html">http://www.opengl.org/developers/documentation/specs.html</a>.)
35 &nbsp;Experience with OpenGL programming is highly advisable.<a
36 href="http://www.opengl.org/developers/documentation/specs.html"><br>
37 </a><br>
38 Tungsten Graphics, Inc. is working with industry standards
39 organizations +in an attempt to standardize this Mesa subset and any
40 other possible subsets +as a result of this work. <br>
41 <br>
42 Appendix A contains a list of issues of which some may not be resolved.<br>
43 <br>
44 To summarize, the following major features of Mesa are omitted from the
45 subset:<br>
46 <ul>
47 <li>Vertex arrays</li>
48 <li>Texture coordinate generation</li>
49 <li>Lighting</li>
50 <li>Point size</li>
51 <li>Polygon stipple</li>
52 <li>DrawPixels, CopyPixels, PixelZoom</li>
53 <li>1-D and 3-D textures</li>
54 <li>CopyTex[Sub]Image</li>
55 <li>Fog</li>
56 <li>Depth test</li>
57 <li>Color Index mode</li>
58 <li>Accumulation buffer</li>
59 <li>Feedback mode</li>
60 <li>Evaluators</li>
61 <li>Push/Pop attributes</li>
62 <li>Display lists<br>
63 </li>
64 </ul>
65 <p>Further reductions are made at a lower level of detail.<br>
66 </p>
67 <p>Mesa function names are printed in <span style="font-weight: bold;">bold
68 face</span>. &nbsp;Function parameters are printed in <span
69 style="font-style: italic;">italics</span>.<br>
70 </p>
71 <p>The Tungsten Graphics, Inc. Mesa subset library is hereafter
72 referred to as <span style="font-style: italic;">the subset.</span><br>
73 <br>
74 </p>
75 <h1>2. Primitive Specification</h1>
76 <h2>2.1 glBegin, glEnd and glVertex Commands</h2>
77 The basic rendering primitives are points, lines and triangles.
78 &nbsp;Quadrilaterals and polygons are composed of triangles.
79 &nbsp;Primitives are drawn with the <span style="font-weight: bold;">glBegin</span>
80 and <span style="font-weight: bold;">glEnd</span> commands and a subset
81 of the <span style="font-weight: bold;">glVertex</span> commands:<br>
82 <br>
83 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glBegin</span>(GLenum<span
84 style="font-style: italic;">mode</span>)<br>
85 void <span style="font-weight: bold;">glEnd</span>(void)<br>
86 <br>
87 void <span style="font-weight: bold;">glVertex2f</span>(GLfloat <span
88 style="font-style: italic;">x</span>, GLfloat <span
89 style="font-style: italic;">y</span>)<br>
90 void <span style="font-weight: bold;">glVertex2fv</span>(const GLfloat
91 *<span style="font-style: italic;">v</span>)<br>
92 void <span style="font-weight: bold;">glVertex3f</span>(GLfloat <span
93 style="font-style: italic;">x</span>, GLfloat <span
94 style="font-style: italic;">y</span>, GLfloat <span
95 style="font-style: italic;">z</span>)<br>
96 void <span style="font-weight: bold;">glVertex3fv</span>(const GLfloat
97 *<span style="font-style: italic;">v</span>)<br>
98 </div>
99 <br>
100 The <span style="font-style: italic;">mode</span> parameter to <span
101 style="font-weight: bold;">glBegin</span> may be one of the following<br>
102 <br>
103 <div style="margin-left: 40px;">GL_POINTS - a series of individual
104 points<br>
105 GL_LINES - a series of disjoint line segments<br>
106 GL_LINE_STRIP - series of connected line segments<br>
107 GL_LINE_LOOP - a closed loop of line segments<br>
108 GL_TRIANGLES - a series of individual triangles<br>
109 GL_TRIANGLE_STRIP - a connected strip of triangles<br>
110 GL_TRIANGLE_FAN - a sequence of triangles all sharing a common vertex<br>
111 GL_QUADS - a sequence of individual quadrilaterals<br>
112 GL_QUAD_STRIP - a connected strip of quadrilaterals<br>
113 GL_POLYGON - a closed, convex polygon<br>
114 <br>
115 </div>
116 <br>
117 The <span style="font-weight: bold;">glVertex</span> commands take two
118 or three floating point coordinates, or a pointer to an array of two or
119 three floating point coordinates. &nbsp;Vertices are actually 4-element
120 homogeneous coordinates. &nbsp;The fourth component, unspecified by the
121 subset's <span style="font-weight: bold;">glVertex</span> commands, is
122 one.<br>
123 <br>
124 <span style="font-weight: bold;"></span>
125 <h2>2.2 Other Per-vertex Commands<br>
126 </h2>
127 The <span style="font-weight: bold;">glColor</span> and <span
128 style="font-weight: bold;">glTexCoord</span> commands may be used to
129 specify colors and texture coordinates for each vertex:<br>
130 <br>
131 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glColor3f</span>(GLfloat<span
132 style="font-style: italic;">red</span>, GLfloat <span
133 style="font-style: italic;">green</span>, GLfloat <span
134 style="font-style: italic;">blue</span>)<br>
135 void <span style="font-weight: bold;">glColor3fv</span>(const GLfloat *<span
136 style="font-style: italic;">rgb</span>)<br>
137 void <span style="font-weight: bold;">glColor4f</span>(GLfloat <span
138 style="font-style: italic;">red,</span> GLfloat <span
139 style="font-style: italic;">green,</span> GLfloat <span
140 style="font-style: italic;">blue,</span> GLfloat <span
141 style="font-style: italic;">alpha</span>)<br>
142 void <span style="font-weight: bold;">glColor4fv</span>(const GLfloat *<span
143 style="font-style: italic;">rgba</span>)<br>
144 void <span style="font-weight: bold;">glTexCoord2f</span>(GLfloat <span
145 style="font-style: italic;">s</span>, GLfloat<span
146 style="font-style: italic;"> t</span>)<br>
147 void <span style="font-weight: bold;">glTexCoord2fv</span>(const
148 GLfloat *<span style="font-style: italic;">c</span>)<br>
149 <br>
150 </div>
151 The <span style="font-weight: bold;">glColor</span> commands specify
152 the color and optionally, the alpha value, for subsequent vertices.
153 &nbsp;For the <span style="font-weight: bold;">glColor3</span> commands,
154 alpha is set to one.<br>
155 <br>
156 The <span style="font-weight: bold;">glTexCoord2</span> commands
157 specify the texture coordinate for subsequent vertices. &nbsp;Texture
158 coordinates are actually four-component coordinates: (s, t, r, q).
159 &nbsp;The <span style="font-weight: bold;">glTexCoord2</span> commands
160 set s and t explicitly. &nbsp;The r and q components are zero and one,
161 respectively.<br>
162 <br>
163 <span style="font-weight: bold;"></span>Only <span
164 style="font-weight: bold;">glVertex, glColor</span> and <span
165 style="font-weight: bold;">glTexCoord</span> commands are allowed
166 between <span style="font-weight: bold;">glBegin</span> and <span
167 style="font-weight: bold;">glEnd.</span> &nbsp;Calling any other
168 command between <span style="font-weight: bold;">glBegin</span> and <span
169 style="font-weight: bold;">glEnd</span> will result in the error
170 GL_INVALID_OPERATION.<br>
171 <br>
172 <h2>2.3 Unsupported Commands</h2>
173 None of the following commands related to primitive specification are
174 supported by the subset:<br>
175 <br>
176 <div style="margin-left: 40px;">Per-Vertex commands:<br>
177 </div>
178 <div style="margin-left: 40px;">
179 <div style="margin-left: 40px;"><span style="font-weight: bold;">glVertex2d,
180 glVertex2i, glVertex2s, glVertex3d, glVertex3i, glVertex3s, glVertex4d,
181 glVertex4i, glVertex4s, glVertex2dv, glVertex2iv, glVertex2sv,
182 glVertex3dv, glVertex3iv, glVertex3sv, glVertex4dv, glVertex4iv,
183 glVertex4sv,<br>
184 glNormal3b, glNormal3d, glNormal3f, glNormal3i, glNormal3s, </span><span
185 style="font-weight: bold;">glNormal3bv, glNormal3dv, glNormal3fv,
186 glNormal3iv, glNormal3sv,<br>
187 glIndexd, glIndexf, glIndexi, glIndexs, glIndexub, glIndexdv,
188 glIndexfv, glIndexiv, glIndexsv, glIndexubv,<br>
189 glColor3b, glColor3d, glColor3i, glColor3s, glColor3ub, glColor3ui,
190 glColor3us, </span><span style="font-weight: bold;">glColor3bv,
191 glColor3dv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv,
192 glColor3usv,</span><span style="font-weight: bold;"> lColor4b,
193 glColor4d, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, </span><span
194 style="font-weight: bold;">glColor4bv, glColor4dv, glColor4iv,
195 glColor4sv, glColor4ubv, glColor4uiv, glColor4usv,<br>
196 </span><span style="font-weight: bold;">glTexCoord1d, glTexCoord1f,
197 glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2i, glTexCoord2s,
198 glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, glTexCoord4d,
199 glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv,
200 glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2iv,
201 glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv,
202 glTexCoord3sv, glTexCoord4dv, glTexCoord4fv, glTexCoord4iv,
203 glTexCoord4sv,<br>
204 glEdgeFlag, glEdgeFlagv</span><br style="font-weight: bold;">
205 <br>
206 </div>
207 Vertex array commands:<br>
208 <div style="margin-left: 40px;"><span style="font-weight: bold;">glVertexPointer,
209 glColorPointer, glIndexPointer, glTexCoordPointer, glEdgeFlagPointer,
210 glNormalPointer, glInterleavedArrays, glArrayElement, glDrawArrays,
211 glDrawElements, glDrawRangeElements, glEnableClientState,
212 glDisableClientState</span><br>
213 </div>
214 </div>
215 <div style="margin-left: 40px;"><br>
216 Rectangle commands:<br>
217 <div style="margin-left: 40px;"><span style="font-weight: bold;">glRects,
218 glRecti, glRectf, glRectd, glRectsv, glRectiv, glRectfv, glRectdv,<br>
219 <br>
220 </span></div>
221 </div>
222 <div style="margin-left: 40px;">Lighting commands:<br>
223 </div>
224 <div style="margin-left: 80px;"><span style="font-weight: bold;">glMaterialf,
225 glMateriali, glMaterialfv, glMaterialiv<br>
226 </span><br>
227 </div>
228 <div style="margin-left: 40px;"> Evaluator commands:<br>
229 <div style="margin-left: 40px;"><span style="font-weight: bold;">glEvalCoord1d,
230 glEvalCoord1f, glEvalCoord1dv, glEvalCoord1fv,&nbsp;</span><span
231 style="font-weight: bold;">glEvalCoord2d, glEvalCoord2f,
232 glEvalCoord2dv, glEvalCoord2fv,<br>
233 </span><span style="font-weight: bold;">glEvalPoint1, glEvalPoint2</span><br>
234 <br>
235 </div>
236 </div>
237 <h1>3. Coordinate Transformation</h1>
238 <h2>3.1 Vertex Transformation</h2>
239 Vertex coordinates are transformed by the current modelview and
240 projection matrices then mapped to window coordinates as specified by
241 the viewport. &nbsp;The following coordinate transformation commands are
242 supported by the subset<br>
243 <br>
244 <div style="margin-left: 40px; font-weight: bold;">glMatrixMode<span
245 style="font-weight: normal;">(GLenum <span style="font-style: italic;">mode</span>)</span><br>
246 glLoadIdentity<span style="font-weight: normal;">(void)</span><br>
247 glPushMatrix<span style="font-weight: normal;">(void)</span><br>
248 glPopMatrix<span style="font-weight: normal;">(void)</span><br>
249 glLoadMatrixf<span style="font-weight: normal;">(const GLfloat *<span
250 style="font-style: italic;">m</span>)</span><br>
251 glMultMatrixf<span style="font-weight: normal;">(const GLfloat *<span
252 style="font-style: italic;">m</span>)</span><br>
253 glRotatef<span style="font-weight: normal;">(GLfloat <span
254 style="font-style: italic;">angle</span>, GLfloat <span
255 style="font-style: italic;">x</span>, GLfloat <span
256 style="font-style: italic;">y</span>, GLfloat <span
257 style="font-style: italic;">z</span>)</span><br>
258 glTranslatef<span style="font-weight: normal;">(GLfloat <span
259 style="font-style: italic;">x</span>, GLfloat <span
260 style="font-style: italic;">y</span>, GLfloat <span
261 style="font-style: italic;">z</span>)</span><br>
262 glScalef<span style="font-weight: normal;">(GLfloat <span
263 style="font-style: italic;">x</span>, GLfloat <span
264 style="font-style: italic;">y</span>, GLfloat <span
265 style="font-style: italic;">z</span>)<br>
266 <span style="font-weight: bold;">glFrustum(</span>GLdouble <span
267 style="font-style: italic;">left,</span> GLdouble <span
268 style="font-style: italic;">right,</span> GLdouble <span
269 style="font-style: italic;">bottom,</span> GLdouble <span
270 style="font-style: italic;">top,</span> GLdouble <span
271 style="font-style: italic;">near,</span> GLdouble <span
272 style="font-style: italic;">far</span>)</span><br>
273 <span style="font-weight: normal;"><span style="font-weight: bold;">glOrtho(</span>GLdouble<span
274 style="font-style: italic;"> left,</span> GLdouble <span
275 style="font-style: italic;">right,</span> GLdouble <span
276 style="font-style: italic;">bottom,</span> GLdouble <span
277 style="font-style: italic;">top,</span> GLdouble <span
278 style="font-style: italic;">near,</span> GLdouble <span
279 style="font-style: italic;">far</span>)</span><br>
280 glViewport<span style="font-weight: normal;">(GLint <span
281 style="font-style: italic;">x</span>, GLint <span
282 style="font-style: italic;">y</span>, GLsize <span
283 style="font-style: italic;">width,</span> GLsizei <span
284 style="font-style: italic;">height</span>)</span><br>
285 </div>
286 <br>
287 The <span style="font-weight: bold;">glMatrixMode</span> command
288 specifies the <span style="font-style: italic;">current matrix.</span>
289 &nbsp;The mode parameter may be GL_MODELVIEW or GL_PROJECTION to specify
290 the modelview matrix or projection matrix. &nbsp;Subsequent matrix
291 commands will effect the current matrix. &nbsp;Also associated with the
292 modelview and projection matrices are a modelview matrix stack and
293 projection matrix stack.<br>
294 <br>
295 The <span style="font-weight: bold;">glLoadIdentity</span> command
296 replaces the current matrix with the identity matrix. &nbsp;The matrix
297 elements are specified in column-major order.<br>
298 <br>
299 The <span style="font-weight: bold;">glPushMatrix</span> command pushes
300 a copy of the current matrix onto either the modelview matrix stack or
301 the projection matrix stack. &nbsp;The <span style="font-weight: bold;">glPopMatrix</span>
302 command replaces the current matrix with a copy of the top matrix off
303 the modelview matrix stack or projection matrix stack, the pops the
304 stack. &nbsp;Matrix stacks are useful for traversing and rendering
305 hierarchical models.<br>
306 <br>
307 The <span style="font-weight: bold;">glMultMatrixf</span> command
308 post-multiplies the current matrix by the specified matrix. &nbsp;The
309 matrix elements are specified in column-major order.<br>
310 <br>
311 The <span style="font-weight: bold;">glRotatef</span> command
312 post-multiplies the current matrix by a rotation matrix defined by the
313 angle and rotation axis defined by x, y and z.<br>
314 <br>
315 The <span style="font-weight: bold;">glTranslatef</span> command
316 post-multiplies the current matrix by a translation matrix defined by
317 the <span style="font-style: italic;">x</span>, <span
318 style="font-style: italic;">y</span> and <span
319 style="font-style: italic;">z</span> translation parameters.<br>
320 <span style="font-weight: bold;"></span><br>
321 The <span style="font-weight: bold;">glScalef</span> command
322 post-multiplies the current matrix by a scaling matrix defined by the <span
323 style="font-style: italic;">x</span>, <span
324 style="font-style: italic;">y</span> and <span
325 style="font-style: italic;">z</span> scale factors.<br>
326 <span style="font-weight: bold;"></span><br>
327 The <span style="font-weight: bold;">glFrustum</span> command
328 post-multiplies the current matrix by a perspective projection matrix.
329 &nbsp;The <span style="font-style: italic;">near</span> and <span
330 style="font-style: italic;">far</span> values specify the position of
331 the hither and yon Z-axis clipping planes. &nbsp;The <span
332 style="font-style: italic;">left, right, bottom</span> and <span
333 style="font-style: italic;">top</span> parameters are the X and Y
334 extents at the near clipping plane. &nbsp;<span
335 style="font-weight: bold;">glFrustum</span> is normally used to modify
336 the projection matrix.<br>
337 <br>
338 The <span style="font-weight: bold;">glOrtho</span> command
339 post-multiplies the current matrix by an orthographic projection matrix.
340 &nbsp;The <span style="font-style: italic;">near</span> and <span
341 style="font-style: italic;">far</span> values specify the position of
342 the hither and yon Z-axis clipping planes. &nbsp;The <span
343 style="font-style: italic;">left, right, bottom</span> and <span
344 style="font-style: italic;">top</span> parameters specify the X and
345 Y-axis clipping planes. &nbsp;<span style="font-weight: bold;">glOrtho</span>
346 is normally used to modify the projection matrix.<br>
347 <br>
348 The <span style="font-weight: bold;">glViewport</span> command
349 specifies the mapping of coordinates from normalized device coordinates
350 to window coordinates. &nbsp;The <span style="font-style: italic;">x</span>
351 and <span style="font-style: italic;">y</span> parameters specify the
352 viewport's lower-left corner in the window and the <span
353 style="font-style: italic;">width</span> and <span
354 style="font-style: italic;">height</span> parameters specify the size
355 of the viewport. &nbsp;<span style="font-weight: bold;">glViewport</span>
356 does not effect the current matrix.<br>
357 <br>
358 A coordinate transformed to window coordinates is hereafter known as (x<sub>w</sub>,
359 y<sub>w</sub>, z<sub>w</sub>).<br>
360 <br>
361 <h2>3.2 Clipping</h2>
362 View-volume clipping automatically discards or trims primitives which
363 lie completely or partially outside of the view volume specified by <span
364 style="font-weight: bold;">glFrustum</span> and <span
365 style="font-weight: bold;">glOrtho</span>. &nbsp;Note that the <span
366 style="font-weight: bold;">glViewport</span> command does not define a
367 clipping region.<br>
368 <br>
369 Clipping occurs in <span style="font-style: italic;">clip coordinate
370 space - </span>the coordinates produced after applying the projection
371 matrix.<br>
372 <br>
373 <h2>3.3 Current Raster Position</h2>
374 The current raster position specifies the location for drawing images
375 with <span style="font-weight: bold;">glBitmap.</span> &nbsp;The current
376 raster position is set with the commands:<br>
377 <br>
378 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glRasterPos2f</span>(GLfloat<span
379 style="font-style: italic;">x</span>, GLfloat <span
380 style="font-style: italic;">y</span>)<br>
381 void <span style="font-weight: bold;">glRasterPos2fv</span>(const
382 GLfloat *<span style="font-style: italic;">v</span>)<br>
383 void <span style="font-weight: bold;">glRasterPos2i</span>(GLint <span
384 style="font-style: italic;">x</span>, GLint <span
385 style="font-style: italic;">y</span>)<br>
386 void <span style="font-weight: bold;">glRasterPos2iv</span>(const
387 GLint *<span style="font-style: italic;">v</span>)<br>
388 </div>
389 <br>
390 <span style="font-weight: bold;">glRasterPos</span> specifies a
391 4-component coordinate (x, y, 0, 1). &nbsp;The coordinate is processed
392 like a vertex; it is transformed by the modelview matrix, the projection
393 matrix and mapped to the viewport. &nbsp;The resulting window coordinate
394 is stored as the current raster position. &nbsp;The coordinate is
395 clipped-tested against the frustum like a vertex. &nbsp;If the
396 coordinate is clipped, then the current raster position becomes invalid
397 and subsequent <span style="font-weight: bold;">glBitmap</span> commands
398 have no effect.<br>
399 <br>
400 <span style="font-weight: bold;">glRasterPos</span> also updates the
401 current raster color and current raster texture coordinates. &nbsp;The
402 current raster color is updated (copied) from the current color (as
403 specified by <span style="font-weight: bold;">glColor</span>).
404 &nbsp;The current raster texture coordinate is updated (copied) from the
405 current texture coordinate (as specified by <span
406 style="font-weight: bold;">glTexCoord</span>).<br>
407 <br>
408 <h2>3.4 Unsupported Commands</h2>
409 The following commands related to vertex transformation are not
410 supported by the subset:<br>
411 <br>
412 <div style="margin-left: 40px;">User-defined clip plane commands:<br>
413 <div style="margin-left: 40px;"><span style="font-weight: bold;">glClipPlane</span><br>
414 </div>
415 <span style="font-weight: bold;"></span></div>
416 <br>
417 <div style="margin-left: 40px;">Lighting and material commands:</div>
418 <div style="margin-left: 80px;"><span style="font-weight: bold;">glLightModeli,
419 glLightModelf,&nbsp;</span><span style="font-weight: bold;">glLightModeliv,
420 glLightModelfv,</span><span style="font-weight: bold;"> glLightf,
421 glLighti, glLightfv, glLightiv, glColorMaterial</span><br>
422 </div>
423 <br>
424 <div style="margin-left: 40px;">Automatic texture coordinate generation
425 commands:<br>
426 </div>
427 <div style="margin-left: 40px;">
428 <div style="margin-left: 40px;"><span style="font-weight: bold;">glTexGend,
429 glTexGenf, glTexGeni, </span><span style="font-weight: bold;">glTexGendv,
430 glTexGenfv, glTexGeniv, </span><br>
431 <br style="font-weight: bold;">
432 </div>
433 Double-valued commands:<br>
434 <div style="margin-left: 40px;"><span style="font-weight: bold;">glLoadMatrixd,
435 glMultMatrixd, glRotated, glTranslated, glScaled</span><br
436 style="font-weight: bold;">
437 </div>
438 <br>
439 Depth Range command:<br>
440 <div style="margin-left: 40px;"><span style="font-weight: bold;">glDepthRange</span>
441 (the near value is always 0.0 and the far value is always 1.0)<br>
442 </div>
443 <br>
444 Extra RasterPos commands:<br>
445 <div style="margin-left: 40px;"><span style="font-weight: bold;">glRasterPos2d,
446 glRasterPos2s, glRasterPos3d, glRasterPos3f, glRasterPos3i,
447 glRasterPos3s, glRasterPos4d, glRasterPos4f, glRasterPos4i,
448 glRasterPos4s, glRasterPos2dv, glRasterPos2sv, glRasterPos3dv,
449 glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, glRasterPos4dv,
450 glRasterPos4fv, glRasterPos4iv, glRasterPos4sv</span><br>
451 </div>
452 <br>
453 <br>
454 </div>
455 <h1>4. Rasterization</h1>
456 This section describes the commands and options for drawing points,
457 lines, triangles and bitmaps. &nbsp;<span style="font-style: italic;">Rasterization</span>
458 is the term for the process which produces fragments from the geometric
459 description of a primitive (a point, line, polygon or bitmap). &nbsp;For
460 example, given the two coordinates for the end-points of a line segment,
461 rasterization determines which pixels in the frame buffer are modified
462 to <span style="font-style: italic;">draw</span> the line. &nbsp;A
463 fragment is a tuple which consists of a window coordinate, colors and
464 texture coordinates. &nbsp;The fragments produced by rasterization are
465 subsequently processed by the per-fragment operations described later.<br>
466 <br>
467 <h2>4.1 Point Rasterization</h2>
468 Points are rendered with the command sequence <span
469 style="font-weight: bold;">glBegin</span>(GL_POINTS), <span
470 style="font-weight: bold;">glVertex</span>, ... <span
471 style="font-weight: bold;">glEnd</span>. &nbsp;The window coordinate (x<sub>w</sub>,
472 y<sub>w</sub>, z<sub>w</sub>) is truncated to rasterize the point.
473 &nbsp;The truncated coordinate with its associated color and texture
474 coordinate is sent as a single fragment to the per-fragment processing
475 stages.<br>
476 <br>
477 The <span style="font-weight: bold;">glPointSize</span> command is not
478 supported; only 1-pixel points are supported.<br>
479 <br>
480 Point smoothing (antialiasing) is also not supported.<br>
481 <br>
482 <h2>4.2 Line Rasterization</h2>
483 Lines are rendered with the command sequence <span
484 style="font-weight: bold;">glBegin</span>(<span
485 style="font-style: italic;">mode</span>), <span
486 style="font-weight: bold;">glVertex</span>, <span
487 style="font-weight: bold;">glVertex</span>, ... <span
488 style="font-weight: bold;">glEnd</span> where <span
489 style="font-style: italic;">mode</span> is one of GL_LINES,
490 GL_LINE_STRIP or GL_LINE_LOOP. &nbsp;Lines are rasterized as described
491 in the OpenGL specification. &nbsp;Note that OpenGL specifies the <span
492 style="font-style: italic;">half-open</span> convention for drawing
493 lines: the last fragment in a line segment is omitted so that endpoint
494 pixels shared by two line segments will only be drawn once instead of
495 twice.<br>
496 <br>
497 <h3>4.2.1 Line Width</h3>
498 The width of lines can be controlled by<br>
499 <br>
500 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glLineWidth</span>(GLfloat<span
501 style="font-style: italic;">width</span>)<br>
502 </div>
503 <br>
504 where <span style="font-style: italic;">width</span> is the line width
505 in pixels. &nbsp;The width defaults to 1.0. &nbsp;Attempting to set the
506 width to a value less than or equal to zero will raise the error
507 GL_INVALID_VALUE.<br>
508 <br>
509 <h3>4.2.2 Line Stipple<br>
510 </h3>
511 Lines may be stippled (i.e. dashed) with the command<br>
512 <br>
513 <div style="margin-left: 40px;"><span style="font-weight: bold;">glLineStipple</span>(GLint<span
514 style="font-style: italic;">factor</span>, GLushort <span
515 style="font-style: italic;">pattern</span>)<br>
516 </div>
517 <br>
518 <span style="font-style: italic;">pattern</span> describes an on/off
519 pattern for the fragments produced by rasterization and <span
520 style="font-style: italic;">factor</span> specifies how many subsequent
521 fragments are kept or culled for each pattern bit. &nbsp;Line stippling
522 can be enabled or disabled by the commands <span
523 style="font-weight: bold;">glEnable</span>(GL_LINE_STIPPLE) and <span
524 style="font-weight: bold;">glDisable</span>(GL_LINE_STIPPLE).<br>
525 <br>
526 <h3>4.2.3 Line Antialiasing</h3>
527 Lines may be antialiased. &nbsp;For antialiased lines, each fragment
528 produced by rasterization is assigned a <span
529 style="font-style: italic;">coverage value</span> which describes how
530 much of the fragment's area is considered to be <span
531 style="font-style: italic;">inside</span> the line. &nbsp;Later, the
532 alpha value of each fragment is multiplied by the coverage value.
533 &nbsp;By blending the fragments into the frame buffer, the edges of
534 lines appear smoothed.<br>
535 <br>
536 Line antialiasing can be enabled or disabled with the commands <span
537 style="font-weight: bold;">glEnable</span>(GL_LINE_SMOOTH) and <span
538 style="font-weight: bold;">glDisable</span>(GL_LINE_SMOOTH).<br>
539 <br>
540 <h2>4.3 Polygon Rasterization</h2>
541 Polygons, quadrilaterals and triangles share the same polygon
542 rasterization options. <br>
543 <br>
544 Triangles are rendered by the command sequence <span
545 style="font-weight: bold;">glBegin</span><span
546 style="font-style: italic;"><span style="font-style: italic;">(mode</span></span>),<span
547 style="font-weight: bold;">glVertex</span>, <span
548 style="font-weight: bold;">glVertex</span>, ... <span
549 style="font-weight: bold;">glEnd</span> where <span
550 style="font-style: italic;">mode</span> may be one of GL_TRIANGLES,
551 GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN.<span style="font-weight: bold;"></span>
552 &nbsp;For GL_TRIANGLES mode, the number of vertices should be a multiple
553 of three - extra vertices will be ignored. &nbsp;For GL_TRIANGLE_STRIP
554 and GL_TRIANGLE_FAN, at least three vertices should be specified.
555 &nbsp;If less than three are specified, nothing is drawn. &nbsp;<br>
556 <br>
557 Quadrilaterals are <span style="font-weight: bold;"></span>rendered by
558 the command sequence <span style="font-weight: bold;">glBegin</span>(<span
559 style="font-style: italic;"><span style="font-style: italic;">mode</span></span>),<span
560 style="font-weight: bold;">glVertex</span>, <span
561 style="font-weight: bold;">glVertex</span>, ... <span
562 style="font-weight: bold;">glEnd</span> where <span
563 style="font-style: italic;">mode</span> may be one of GL_QUADS or
564 GL_QUAD_STRIP.<span style="font-weight: bold;"></span> &nbsp; For
565 GL_QUADS, the number of vertices should be a multiple of four - extra
566 vertices will be ignored. &nbsp;For GL_QUAD_STRIP, the number of
567 vertices should be even and at least four. &nbsp;Extra vertices (one)
568 will be ignored.<br>
569 <br>
570 Convex polygons are <span style="font-weight: bold;"></span>rendered
571 by the command sequence <span style="font-weight: bold;">glBegin</span><span
572 style="font-style: italic;"><span style="font-style: italic;"></span></span>(GL_POLYGON),<span
573 style="font-weight: bold;">glVertex</span>, <span
574 style="font-weight: bold;">glVertex</span>, ... <span
575 style="font-weight: bold;">glEnd</span>.<span
576 style="font-style: italic;"></span><span style="font-weight: bold;"></span>
577 &nbsp;If less than three vertices are specified, nothing is drawn.<br>
578 <br>
579 <h3>4.3.1 Polygon Orientation</h3>
580 The <span style="font-style: italic;">winding order</span> of vertices
581 (clockwise or counter-clockwise) is significant. &nbsp;It is used to
582 determine the <span style="font-style: italic;">front-facing</span> or <span
583 style="font-style: italic;">back-facing</span> orientation of polygons.
584 &nbsp;By default, a front-facing polygon's vertices are in
585 counter-clockwise order (in window coordinates). &nbsp;Figures 2.4 and
586 2.5 of the OpenGL 1.2.1 specification illustrate the winding order for
587 front-facing triangles and quadrilaterals, respectively.<br>
588 <br>
589 The command<br>
590 <br>
591 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glFrontFace</span>(GLenum<span
592 style="font-style: italic;"> mode</span>)<br>
593 </div>
594 <br>
595 specifies whether clockwise or counter-clockwise winding indicates a
596 front-facing polygon. &nbsp;If <span style="font-style: italic;">mode</span>
597 is GL_CW then polygons with clockwise winding are front-facing. &nbsp;If <span
598 style="font-style: italic;">mode</span> is GL_CCW then polygons with
599 counter-clockwise winding are front-facing. &nbsp;The default value is
600 GL_CCW. &nbsp;If <span style="font-style: italic;">mode</span> is not
601 GL_CCW or GL_CW then the error GL_INVALID_ENUM will be raised.<span
602 style="font-style: italic;"></span><span style="font-style: italic;"></span><br>
603 <br>
604 <h3>4.3.2 Polygon Culling</h3>
605 Polygons may be culled (discarded) depending on whether they are
606 front-facing or back-facing. &nbsp;The command<br>
607 <br>
608 <div style="margin-left: 40px;">void<span style="font-weight: bold;">
609 glCullFace</span>(GLenum <span style="font-style: italic;">mode</span>)<br>
610 </div>
611 <br>
612 specifies whether front-facing, back-facing or all polygons should be
613 culled. &nbsp;If <span style="font-style: italic;">mode</span> is
614 GL_FRONT then front-facing polygons will be culled. &nbsp;If <span
615 style="font-style: italic;">mode</span> is GL_BACK then back-facing
616 polygons will be culled. Otherwise, if <span style="font-style: italic;">mode</span>
617 is GL_FRONT_AND_BACK then all polygons will be culled. &nbsp;Any other
618 value for <span style="font-style: italic;">mode</span> will raise the
619 error GL_INVALID_ENUM.<br>
620 <br>
621 Polygon culling is enabled and disabled with the commands <span
622 style="font-weight: bold;">glEnable</span>(GL_CULL_FACE) and <span
623 style="font-weight: bold;">glDisable</span>(GL_CULL_FACE),
624 respectively.<br>
625 <br>
626 <h3>4.3.3 Polygon Antialiasing</h3>
627 Polygons may be antialiased in order to smooth their edges.
628 &nbsp;Polygon antialiasing is enabled and disabled with the commands <span
629 style="font-weight: bold;">glEnable</span>(GL_POLYGON_SMOOTH) and <span
630 style="font-weight: bold;">glDisable</span>(GL_POLYGON_SMOOTH).<br>
631 <br>
632 When polygon antialiasing is enabled each fragment produced by polygon,
633 triangle and quadrilateral rasterization will be given a <span
634 style="font-style: italic;">coverage</span> value which indicates how
635 much of the fragment is covered by the polygon. &nbsp;Fragments
636 completely inside the polygon have coverage 1.0. &nbsp;Fragments
637 completely outside the polygon have zero coverage (in theory).
638 &nbsp;Fragments which intersect the polygon's edge have a coverage value
639 in the range (0, 1).<br>
640 <br>
641 The fragment's alpha value is multiplied by the coverage value.
642 &nbsp;By enabling the appropriate blending mode, polygon edges will
643 appear smoothed.<br>
644 <br>
645 <h2>4.4 Shading</h2>
646 The command<br>
647 <br>
648 <div style="margin-left: 40px;"> void <span style="font-weight: bold;">glShadeModel</span>(GLenum<span
649 style="font-style: italic;">mode</span>)<br>
650 </div>
651 <br>
652 determines whether colors are interpolated between vertices during
653 rasterization. &nbsp;If <span style="font-style: italic;">mode</span> is
654 GL_FLAT then vertex colors are not interpolated. &nbsp;The color used
655 for drawing lines, triangles and quadrilaterals is that of the last
656 vertex used to specify each primitive. &nbsp;For polygons, the color of
657 the first vertex specifies the color for the entire polygon. &nbsp;If <span
658 style="font-style: italic;">mode</span> is GL_SMOOTH then vertex colors
659 are linearly interpolated to produce the fragment colors.<br>
660 <br>
661 <h2>4.5 Bitmap Rasterization</h2>
662 A bitmap is a monochromatic, binary image in which each image element
663 (or pixel) is represented by one bit. &nbsp;Fragments are only generated
664 for the bits (pixels) which are set. &nbsp;Bitmaps are commonly used to
665 draw text (glyphs) and markers.<br>
666 <br>
667 A bitmap is drawn with the command<br>
668 <br>
669 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glBitmap</span>(GLsizei<span
670 style="font-style: italic;">width</span>, GLsizei <span
671 style="font-style: italic;">height</span>, GLfloat <span
672 style="font-style: italic;">xOrig</span>, GLfloat <span
673 style="font-style: italic;">yOrig</span>, GLfloat <span
674 style="font-style: italic;">xMove</span>, GLfloat <span
675 style="font-style: italic;">yMove</span>, const &nbsp;GLubyte *<span
676 style="font-style: italic;">image</span>)<br>
677 </div>
678 <br>
679 <span style="font-style: italic;">width </span>and <span
680 style="font-style: italic;">height</span> specify the image size in
681 pixels. &nbsp;<span style="font-style: italic;">xOrig</span> and <span
682 style="font-style: italic;">yOrig</span> specify the bitmap origin.
683 &nbsp;<span style="font-style: italic;">xMove</span> and <span
684 style="font-style: italic;">yMove</span> are added to the current
685 raster position after the bitmap is rasterized. &nbsp;<span
686 style="font-style: italic;">image</span> is a pointer to the bitmap
687 data.<br>
688 <br>
689 If the current raster position is not valid, <span
690 style="font-weight: bold;">glBitmap</span> has no effect.<br>
691 <br>
692 <h3>4.5.1 Bitmap Unpacking</h3>
693 The first step in bitmap rendering is <span style="font-style: italic;">unpacking.
694 &nbsp;</span>Unpacking is the process of extracting image data from
695 client memory subject to byte swapping, non-default row strides, etc.
696 &nbsp;The unpacking parameters are specified with the command<br>
697 <br>
698 <div style="margin-left: 40px;">void<span style="font-weight: bold;">
699 glPixelStorei</span>(GLenum pname, GLint value)<br>
700 </div>
701 <span style="font-style: italic;"></span><br>
702 The following unpacking parameters may be set:<br>
703 <br>
704 <table cellpadding="2" cellspacing="2" border="1"
705 style="text-align: left; width: 90%; margin-left: auto; margin-right: auto;">
706 <tbody>
707 <tr>
708 <td style="vertical-align: top;">Parameter (<span
709 style="font-style: italic;">pname</span>)<br>
710 </td>
711 <td style="vertical-align: top;">Value (<span
712 style="font-style: italic;">value</span>)<br>
713 </td>
714 <td style="vertical-align: top;">Default<br>
715 </td>
716 </tr>
717 <tr>
718 <td style="vertical-align: top;">GL_UNPACK_ROW_LENGTH<br>
719 </td>
720 <td style="vertical-align: top;">Width of the image in memory, in
721 pixels.<br>
722 </td>
723 <td style="vertical-align: top;">0<br>
724 </td>
725 </tr>
726 <tr>
727 <td style="vertical-align: top;">GL_UNPACK_LSB_FIRST<br>
728 </td>
729 <td style="vertical-align: top;">GL_FALSE indicates that the most
730 significant bit is unpacked first from each byte. &nbsp;GL_TRUE
731 indicates that the least significant bit is unpacked first from each
732 byte. <br>
733 </td>
734 <td style="vertical-align: top;">GL_FALSE<br>
735 </td>
736 </tr>
737 </tbody>
738 </table>
739 <br>
740 <br>
741 The GL_UNPACK_ROW_LENGTH specifies the stride (in pixels) for advancing
742 from one row of the image to the next.&nbsp; If it's zero, the <span
743 style="font-style: italic;">width</span> parameter to <span
744 style="font-weight: bold;">glBitmap</span> specifies the width of the
745 image in memory.<br>
746 <br>
747 GL_UNPACK_LSB_FIRST determines whether the least significant or most
748 significant bit in each byte is unpacked first. &nbsp;Unpacking occurs
749 in left to right order (in image space).<br>
750 <br>
751 The value of bit (i, j) of the image (where i is the image row and j is
752 the image column) is found as follows:<br>
753 <br>
754 <div style="margin-left: 40px;">rowLength = (GL_UNPACK_ROW_LENGTH != 0)
755 ? GL_UNPACK_ROW_LENGTH : <span style="font-style: italic;">width</span>;<br>
756 <br>
757 byte = <span style="font-style: italic;">image</span>[((rowLength + 7)
758 / 8) * i + j / 8];<br>
759 <br>
760 if (GL_UNPACK_LSB_FIRST != 0)<br>
761 &nbsp;&nbsp;&nbsp; bitMask = 1 &lt;&lt; (j % 8);<br>
762 else<br>
763 &nbsp;&nbsp;&nbsp; bitMask = 128 &gt;&gt; (j % 8);<br>
764 <br>
765 if (byte &amp; bitMask)<br>
766 &nbsp;&nbsp;&nbsp; bit = 1;<br>
767 else<br>
768 &nbsp;&nbsp;&nbsp; bit = 0;<br>
769 <br>
770 </div>
771 <span style="font-style: italic;"><span style="font-style: italic;"></span></span>
772 <h3>4.5.2 Rasterization</h3>
773 If the current raster position is (x<sub>rp</sub>, y<sub>rp</sub>, z<sub>rp</sub>,
774 w<sub>rp</sub>), then the bitmap is rasterized according to the
775 following algorithm:<br>
776 <br>
777 for (j = 0; j &lt; <span style="font-style: italic;">height</span>;
778 j++) {<br>
779 &nbsp;&nbsp;&nbsp; for (i = 0; i &lt; <span style="font-style: italic;">width</span>;
780 i++) {<br>
781 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (bit(i,j)) {<br>
782 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fragment.x =
783 floor(x<sub>rp</sub> - <span style="font-style: italic;">xOrig</span>)
784 + i;<br>
785 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fragment.y =
786 floor(y<sub>rp</sub> - <span style="font-style: italic;">yOrig</span>)
787 + j;<br>
788 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fragment.color
789 = GL_CURRENT_RASTER_COLOR;<br>
790 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
791 fragment.texture = GL_CURRENT_RASTER_TEXTURE_COORDS;<br>
792 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
793 ProcessFragment(fragment)<br>
794 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br>
795 &nbsp;&nbsp;&nbsp; }<br>
796 }<br>
797 <br>
798 After the bitmap has been rendered the current raster position is
799 updated as follows:<br>
800 <br>
801 <div style="margin-left: 40px;">x<sub>rp</sub> = x<sub>rp</sub> + <span
802 style="font-style: italic;">xMove</span><br>
803 y<sub>rp</sub> = y<sub>rp</sub> + <span style="font-style: italic;">yMove</span><br>
804 </div>
805 <br>
806 <h3>4.5.3 Per-fragment Operations</h3>
807 XXX supported? &nbsp;See issue in appendix A.<br>
808 <br>
809 <h2>4.6 Unsupported Commands</h2>
810 The following commands related to rasterization are not supported by
811 the subset.<br>
812 <br>
813 <div style="margin-left: 40px;">Point commands:<br>
814 <div style="margin-left: 40px;"><span style="font-weight: bold;">glPointSize</span><br>
815 </div>
816 <br>
817 Polygon commands:<br>
818 <div style="margin-left: 40px; font-weight: bold;">glPolygonStipple<br>
819 glPolygonOffset<br>
820 glPolygonMode<br>
821 <br>
822 </div>
823 </div>
824 <div style="margin-left: 40px;">Pixel storage commands:<br>
825 </div>
826 <div style="font-weight: bold; margin-left: 80px;">glPixelStoref<br>
827 </div>
828 <br>
829 <br>
830 <h1>5. Texture Mapping<br>
831 </h1>
832 There are four elements to texture mapping: texture coordinate
833 specification, texture image specification, texture sampling and texture
834 application.<br>
835 <br>
836 Texture mapping is enabled and disabled with the commands <span
837 style="font-weight: bold;">glEnable</span>(GL_TEXTURE_2D) and <span
838 style="font-weight: bold;">glDisable</span>(GL_TEXTURE_2D).<br>
839 <br>
840 <h2>5.1 Texture Image Specification</h2>
841 A texture image is specified with the command:<br>
842 <br>
843 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glTexImage2D</span>(GLenum<span
844 style="font-style: italic;"> target</span>, GLint <span
845 style="font-style: italic;">level</span>, GLint <span
846 style="font-style: italic;">internalFormat,</span> GLsizei <span
847 style="font-style: italic;">width,</span> GLsizei <span
848 style="font-style: italic;">height,</span> GLint <span
849 style="font-style: italic;">border,</span> GLenum <span
850 style="font-style: italic;">format,</span> GLenum <span
851 style="font-style: italic;">type,</span> const GLvoid *<span
852 style="font-style: italic;">pixels</span> )<br>
853 </div>
854 <br>
855 <span style="font-style: italic;">target</span> must be GL_TEXTURE_2D.
856 &nbsp;<span style="font-style: italic;">level </span>indicates the
857 mipmap level for mipmap textures. &nbsp;<span style="font-style: italic;">internalFormat</span>
858 is a hint to indicate the preferred internal storage format for the
859 texture. &nbsp;<span style="font-style: italic;">width</span> and <span
860 style="font-style: italic;">height </span>indicate the image size in
861 pixels (or texels). &nbsp;<span style="font-style: italic;">border </span>must
862 be zero. &nbsp;<span style="font-style: italic;">format</span> and <span
863 style="font-style: italic;">type</span> describe the pixel format and
864 data type for the incoming image. &nbsp;<span style="font-style: italic;">pixels</span>
865 points to the incoming texture image. &nbsp;These parameters are
866 described in more detail below.<br>
867 <br>
868 <h3>5.1.1 Texture Image Size and Mipmaps</h3>
869 <h3><span style="font-style: italic;"></span></h3>
870 Texture images must have dimensions (width and height) that are powers
871 of two. For example: 256 x 256, 32 x 1024, 1 x 8, etc. &nbsp;That is, it
872 must be the case that <span style="font-style: italic;">width </span>=
873 2<sup>n</sup> and <span style="font-style: italic;">height</span> = 2<sup>m</sup>
874 for some positive integers n and m.<br>
875 <br>
876 Mipmapping is a method of antialiasing or filtering textures to improve
877 their appearance. &nbsp;A mipmap is a set of images consisting of a base
878 image and a set of filtered, reduced-resolution images. &nbsp;If the
879 base image (<span style="font-style: italic;">level</span>=0) is of
880 width 2<sup>n</sup> and height 2<sup>m</sup> then the level 1 image must
881 be of width 2<sup>n-1</sup> and height 2<sup>m-1</sup>. &nbsp;Each mipmap
882 level is half the width and height of the previous level, or at least
883 one. &nbsp;The last mipmap level has a width and height of one.<br>
884 <br>
885 The following is an example of a mipmap's image levels:<br>
886 <br>
887 <table cellpadding="2" cellspacing="2" border="1"
888 style="text-align: left; width: 50%; margin-left: auto; margin-right: auto;">
889 <tbody>
890 <tr>
891 <td style="vertical-align: top;">mipmap level<br>
892 </td>
893 <td style="vertical-align: top;">width<br>
894 </td>
895 <td style="vertical-align: top;">height<br>
896 </td>
897 </tr>
898 <tr>
899 <td style="vertical-align: top;">0<br>
900 </td>
901 <td style="vertical-align: top;">256<br>
902 </td>
903 <td style="vertical-align: top;">64<br>
904 </td>
905 </tr>
906 <tr>
907 <td style="vertical-align: top;">1<br>
908 </td>
909 <td style="vertical-align: top;">128<br>
910 </td>
911 <td style="vertical-align: top;">32<br>
912 </td>
913 </tr>
914 <tr>
915 <td style="vertical-align: top;">2<br>
916 </td>
917 <td style="vertical-align: top;">64<br>
918 </td>
919 <td style="vertical-align: top;">16<br>
920 </td>
921 </tr>
922 <tr>
923 <td style="vertical-align: top;">3<br>
924 </td>
925 <td style="vertical-align: top;">32<br>
926 </td>
927 <td style="vertical-align: top;">8<br>
928 </td>
929 </tr>
930 <tr>
931 <td style="vertical-align: top;">4<br>
932 </td>
933 <td style="vertical-align: top;">16<br>
934 </td>
935 <td style="vertical-align: top;">4<br>
936 </td>
937 </tr>
938 <tr>
939 <td style="vertical-align: top;">5<br>
940 </td>
941 <td style="vertical-align: top;">8<br>
942 </td>
943 <td style="vertical-align: top;">2<br>
944 </td>
945 </tr>
946 <tr>
947 <td style="vertical-align: top;">6<br>
948 </td>
949 <td style="vertical-align: top;">4<br>
950 </td>
951 <td style="vertical-align: top;">1<br>
952 </td>
953 </tr>
954 <tr>
955 <td style="vertical-align: top;">7<br>
956 </td>
957 <td style="vertical-align: top;">2<br>
958 </td>
959 <td style="vertical-align: top;">1<br>
960 </td>
961 </tr>
962 <tr>
963 <td style="vertical-align: top;">8<br>
964 </td>
965 <td style="vertical-align: top;">1<br>
966 </td>
967 <td style="vertical-align: top;">1<br>
968 </td>
969 </tr>
970 </tbody>
971 </table>
972 <br>
973 If the <span style="font-style: italic;">width</span> or <span
974 style="font-style: italic;">height</span> parameters are not powers of
975 two, the error GL_INVALID_VALUE is raised. &nbsp;If the image levels in
976 a mipmap do not satisfy the restrictions listed above the texture is
977 considered to be <span style="font-style: italic;">inconsistent</span>
978 and the system will behave as if the texturing is disabled.<br>
979 <br>
980 <h3>5.1.2 Texture Image Formats and Unpacking</h3>
981 The <span style="font-weight: bold;">glTexImage2D</span> command's <span
982 style="font-style: italic;"><span style="font-weight: bold;"></span></span><span
983 style="font-style: italic;">format</span> and <span
984 style="font-style: italic;">type</span> parameters describe the format
985 of the incoming texture image.&nbsp; Accepted values for <span
986 style="font-style: italic;">format</span> are GL_INTENSITY, GL_RGB and
987 GL_RGBA. &nbsp;The <span style="font-style: italic;">type</span>
988 parameter must be GL_UNSIGNED_BYTE. &nbsp;Pixel component values are
989 thus in the range 0 through 255.<br>
990 <br>
991 If <span style="font-style: italic;">format</span> is GL_INTENSITY then
992 the image has one byte per pixel which specifies the pixel's red, green,
993 blue and alpha values.<span style="font-style: italic;"></span><br>
994 <br>
995 If <span style="font-style: italic;">format</span> is GL_RGB then the
996 image has three bytes per pixel which specify the pixel's red, green and
997 blue values (in that order). &nbsp;The alpha value defaults to 255.<br>
998 <br>
999 If <span style="font-style: italic;">format</span> is GL_RGBA then the
1000 image has four bytes per pixel which specify the pixel's red, green,
1001 blue and alpha values (in that order).<br>
1002 <br>
1003 The command<br>
1004 <br>
1005 <div style="margin-left: 40px;">void<span style="font-weight: bold;">
1006 glPixelStorei</span>(GLenum <span style="font-style: italic;">pname</span>,
1007 GLint <span style="font-style: italic;">value</span>)<br>
1008 </div>
1009 <br>
1010 controls the unpacking of texture image data from client memory. &nbsp;<span
1011 style="font-style: italic;">pname</span> may be GL_UNPACK_ROW_LENGTH to
1012 indicate the stride, in pixels, between subsequent rows of the image in
1013 client memory. &nbsp;If GL_UNPACK_ROW_LENGTH is zero (the default) then
1014 the <span style="font-style: italic;">width</span> parameter to <span
1015 style="font-weight: bold;">glTexImage2D </span>determines the stride.<span
1016 style="font-style: italic;"></span><br>
1017 <br>
1018 <h3>5.1.3 Internal Texture Format</h3>
1019 <span style="font-weight: bold;">glTexImage2D<span
1020 style="font-style: italic;"> </span></span>converts the incoming
1021 texture image to one of the supported internal texture formats.<br>
1022 <br>
1023 The <span style="font-style: italic;">internalFormat</span> parameter
1024 indicates the desired internal format for the texture and may be either
1025 GL_INTENSITY8, GL_RGB5 or GL_RGBA8.<br>
1026 <br>
1027 If <span style="font-style: italic;">internalFormat</span> is
1028 GL_INTENSITY8 then the texture has one byte per texel (texture element)
1029 which indicates the texel's intensity (or brightness). &nbsp;The
1030 intensity is obtained from the incoming image's red channel.<br>
1031 <br>
1032 If <span style="font-style: italic;">internalFormat</span> is GL_RGB5
1033 then the texture is stored with two bytes per texel: &nbsp;5 bits per
1034 red value, 5 bits per green value and 5 bits per blue value.<br>
1035 <br>
1036 If <span style="font-style: italic;">internalFormat </span>is
1037 GL_RGBA8 then the texture is stored with four bytes per texel: &nbsp;8
1038 bits for each of the red, green, &nbsp;blue and alpha values.<br>
1039 <br>
1040 The internal format is also significant to texture application (see
1041 section 5.4).<br>
1042 <br>
1043 <h2>5.2 Texture Coordinates</h2>
1044 Texture coordinates control the mapping from local polygon space to
1045 texture image space. &nbsp;Texture coordinates are set for each vertex
1046 with the <span style="font-weight: bold;">glTexCoord</span> commands.
1047 &nbsp;During line and polygon rasterization the vertex's texture
1048 coordinates are interpolated across the primitive to produce a texture
1049 coordinate for each fragment. &nbsp;The fragment texture coordinates are
1050 used to sample the current texture image.<br>
1051 <br>
1052 Texture coordinates are normally in the range [0, 1]. &nbsp;Values
1053 outside that range are processed according to the <span
1054 style="font-style: italic;">texture wrap mode</span>. &nbsp;The
1055 texture wrap mode is set with the command<br>
1056 <br>
1057 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glTexParameteri</span>(GLenum<span
1058 style="font-style: italic;"> target</span>, GLenum <span
1059 style="font-style: italic;">pname</span>, GLint <span
1060 style="font-style: italic;">value</span>)<br>
1061 <br>
1062 </div>
1063 <span style="font-style: italic;">target</span> must be GL_TEXTURE_2D.
1064 &nbsp;If <span style="font-style: italic;">pname</span> is
1065 GL_TEXTURE_WRAP_S or GL_TEXTURE_WRAP_T then <span
1066 style="font-style: italic;">value</span> must be either
1067 GL_CLAMP_TO_EDGE or GL_REPEAT.<br>
1068 <br>
1069 For GL_CLAMP_TO_EDGE, texture coordinates are effectively clamped to
1070 the interval [0, 1].<br>
1071 <br>
1072 For GL_REPEAT, the integer part of texture coordinates is ignored; only
1073 the fractional part of the texture coordinates is used. &nbsp;This
1074 allows texture images to repeated or tiled across an object.<br>
1075 <br>
1076 <h2>5.3 Texture Sampling</h2>
1077 Texture sampling is the process of using texture coordinates to extract
1078 a color from the texture image. &nbsp;Multiple, weighted samples may be
1079 taken from the texture and combined during the filtering step.<br>
1080 <br>
1081 During texture coordinate interpolation a <span
1082 style="font-style: italic;">level of detail</span> value (lambda) is
1083 computed for each fragment. &nbsp;For a mipmapped texture, lambda
1084 determines which level (or levels) of the mipmap will be sampled to
1085 obtain the texture color.<br>
1086 <br>
1087 If lambda indicates that multiple texels map to a single screen pixel,
1088 then the texture <span style="font-style: italic;">minification</span>
1089 filter will be used. &nbsp;Otherwise, if lambda indicates that a single
1090 texel maps to multiple screen pixels, then the texture <span
1091 style="font-style: italic;">magnification</span> filter will be used.<br>
1092 <span style="font-weight: bold;"></span><span
1093 style="font-style: italic;"></span><br>
1094 <h3>5.3.1 Texture Minification</h3>
1095 The texture minification filter is set with the <span
1096 style="font-weight: bold;">glTexParameteri </span><span
1097 style="font-style: italic;"></span><span style="font-weight: bold;"></span><span
1098 style="font-style: italic;"></span> command by setting <span
1099 style="font-style: italic;">target</span> to GL_TEXTURE_2D, setting <span
1100 style="font-style: italic;">pname</span> to GL_TEXTURE_MIN_FILTER and
1101 setting <span style="font-style: italic;">value</span> to GL_NEAREST,
1102 GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST,&nbsp;
1103 GL_NEAREST_MIPMAP_LINEAR,&nbsp; &nbsp;GL_LINEAR_MIPMAP_NEAREST or
1104 GL_LINEAR_MIPMAP_LINEAR.<br>
1105 <br>
1106 GL_NEAREST samples the texel nearest the texture coordinate in the
1107 level 0 texture image.<br>
1108 <br>
1109 GL_LINEAR samples the four texels around the texture coordinate in the
1110 level 0 texture image. &nbsp;The four texels are linearly weighted to
1111 compute the final texel value.<br>
1112 <br>
1113 GL_NEAREST_MIPMAP_NEAREST samples the texel nearest the texture
1114 coordinate in the level N texture image. &nbsp;N is the level of detail
1115 and is computed by the partial derivatives of the texture coordinates
1116 with respect to the window coordinates.<br>
1117 <br>
1118 GL_NEAREST_MIPMAP_LINEAR samples two texels nearest the texture
1119 coordinates in the level N and N+1 texture images. &nbsp;The two texels
1120 are linearly weighted to compute the final texel value. &nbsp;N is the
1121 level of detail and is computed by the partial derivatives of the
1122 texture coordinates with respect to the window coordinates.<br>
1123 <br>
1124 GL_LINEAR_MIPMAP_NEAREST samples four texels around the texture
1125 coordinate in the level N texture image. &nbsp;The four texels are
1126 linearly weighted to compute the final texel value. &nbsp;N is the level
1127 of detail and is computed by the partial derivatives of the texture
1128 coordinates with respect to the window coordinates.<br>
1129 <br>
1130 GL_LINEAR_MIPMAP_LINEAR samples four texels around the texture
1131 coordinate in the level N texture image and four texels around the
1132 texture coordinate in the level N+1 texture image. &nbsp;The eight
1133 texels are linearly weighted to compute the final texel value. &nbsp;N
1134 is the level of detail and is computed by the partial derivatives of the
1135 texture coordinates with respect to the window coordinates.<br>
1136 <br>
1137 Filter modes other than GL_LINEAR and GL_NEAREST requires that the
1138 texture have a complete set of mipmaps. &nbsp;If the mipmap is
1139 incomplete, it is as if texturing is disabled.<br>
1140 &nbsp;<br>
1141 <h3>5.3.2 Texture Magnification</h3>
1142 The texture magnification filter is set with the <span
1143 style="font-weight: bold;">glTexParameteri </span><span
1144 style="font-style: italic;"></span><span style="font-weight: bold;"></span>command
1145 by setting <span style="font-style: italic;">target</span> to
1146 GL_TEXTURE_2D, setting <span style="font-style: italic;">pname</span> to
1147 GL_TEXTURE_MAG_FILTER and setting <span style="font-style: italic;">value</span>
1148 to GL_NEAREST or GL_LINEAR.<br>
1149 <br>
1150 GL_NEAREST samples the texel nearest the texture coordinate in the
1151 level 0 texture image.<br>
1152 <br>
1153 GL_LINEAR samples the four texels around the texture coordinate in the
1154 level 0 texture image. &nbsp;The four texels are linearly weighted to
1155 compute the final texel value.<br>
1156 <br>
1157 <h2>5.4 Texture Application</h2>
1158 The sampled texture value is combined with the incoming fragment color
1159 to produce a new fragment color. &nbsp;The fragment and texture colors
1160 are combined according to the texture environment mode and the current
1161 texture's base internal format. &nbsp;The texture environment mode is
1162 set with the command<br>
1163 <br>
1164 <div style="margin-left: 40px;">void<span style="font-weight: bold;">
1165 glTexEnvi</span>(GLenum <span style="font-style: italic;">target</span>,
1166 GLenum <span style="font-style: italic;">pname</span>, GLint <span
1167 style="font-style: italic;">value</span>)<br>
1168 </div>
1169 <br>
1170 <span style="font-style: italic;">target</span> must be GL_TEXTURE_ENV.
1171 &nbsp;If <span style="font-style: italic;">pname</span> is
1172 GL_TEXTURE_ENV_MODE then <span style="font-style: italic;">value</span>
1173 must be one of GL_REPLACE, GL_MODULATE, GL_DECAL, or GL_BLEND.<br>
1174 <br>
1175 There is also a <span style="font-style: italic;">texture environment
1176 color</span> that can factor into texture application. &nbsp;The texture
1177 environment color can be set with the command<br>
1178 <br>
1179 <div style="margin-left: 40px;">void<span style="font-weight: bold;">
1180 glTexEnvfv</span>(GLenum <span style="font-style: italic;">target</span>,
1181 GLenum <span style="font-style: italic;">pname</span>, const GLfloat *<span
1182 style="font-style: italic;">value</span>)<br>
1183 </div>
1184 <span style="font-style: italic;"></span><br>
1185 <span style="font-style: italic;">target</span> must be GL_TEXTURE_ENV.
1186 &nbsp;If <span style="font-style: italic;">pname</span> is
1187 GL_TEXTURE_ENV_COLOR then <span style="font-style: italic;">value </span>must
1188 point to an array of four values which specify the red, green, blue,
1189 and alpha values of the texture environment color. &nbsp;The values are
1190 clamped to the range [0, 1]. &nbsp;The default color is (0, 0, 0, 0).<br>
1191 <span style="font-style: italic;"></span><br>
1192 The following table describes the arithmetic used for each combination
1193 of environment mode and base internal format. &nbsp;(Rf, Gf, Bf, Af) is
1194 the incoming fragment color. &nbsp;(Rt, Gt, Bt, At) is the sampled
1195 texture color. &nbsp;Lt is the sampled texture luminance. &nbsp;<span
1196 style="font-style: italic;"></span>'It' is the sampled texture
1197 intensity. &nbsp;(Rc, Gc, Bc, Ac) is the texture environment color.
1198 &nbsp;(Rv, Gv, Bv, Av) is the resulting value.<br>
1199 <br>
1200 <br>
1201 <table cellpadding="2" cellspacing="2" border="1"
1202 style="text-align: left; width: 90%; margin-left: auto; margin-right: auto;">
1203 <tbody>
1204 <tr>
1205 <td style="vertical-align: top;">Base Internal Format<br>
1206 </td>
1207 <td style="vertical-align: top;">GL_REPLACE<br>
1208 </td>
1209 <td style="vertical-align: top;">GL_MODULATE<br>
1210 </td>
1211 <td style="vertical-align: top;">GL_DECAL<br>
1212 </td>
1213 <td style="vertical-align: top;">GL_BLEND<br>
1214 </td>
1215 </tr>
1216 <tr>
1217 <td style="vertical-align: top;">GL_INTENSITY<br>
1218 </td>
1219 <td style="vertical-align: top;">Rv = It<br>
1220 Gv = It<br>
1221 Bv = It<br>
1222 Bf = It<br>
1223 </td>
1224 <td style="vertical-align: top;">Rv = Rf * It<br>
1225 Gv = Gf * It<br>
1226 Bv = Bf * It<br>
1227 Av = Af * It</td>
1228 <td style="vertical-align: top;">undefined<br>
1229 </td>
1230 <td style="vertical-align: top;">Rv = Rf*(1-It) + Rc*It<br>
1231 Gv = Gf*(1-It) + Gc*It<br>
1232 Bv = Bf*(1-It) + Bc*It<br>
1233 Av = Af*(1-It) + Ac*It</td>
1234 </tr>
1235 <tr>
1236 <td style="vertical-align: top;">GL_RGB<br>
1237 </td>
1238 <td style="vertical-align: top;">Rv = Rt<br>
1239 Gv = Gt<br>
1240 Bv = Bt<br>
1241 Av = Af<br>
1242 </td>
1243 <td style="vertical-align: top;">Rv = Rf * Rt<br>
1244 Gv = Gf * Gt<br>
1245 Bv = Bf * Bt<br>
1246 Av = Af<br>
1247 </td>
1248 <td style="vertical-align: top;">Rv = Rt<br>
1249 Gv = Gt<br>
1250 Bv = Bt<br>
1251 Av = Af</td>
1252 <td style="vertical-align: top;">Rv = Rf*(1-Rt) + Rc*Rt<br>
1253 Gv = Gf*(1-Gt) + Gc*Gt<br>
1254 Bv = Bf*(1-Bt) + Bc*Bt<br>
1255 Av = Af</td>
1256 </tr>
1257 <tr>
1258 <td style="vertical-align: top;">GL_RGBA<br>
1259 </td>
1260 <td style="vertical-align: top;">Rv = Rt<br>
1261 Gv = Gt<br>
1262 Bv = Bt<br>
1263 Av = At<br>
1264 </td>
1265 <td style="vertical-align: top;">Rv = Rf * Rt<br>
1266 Gv = Gf * Gt<br>
1267 Bv = Bf * Bt<br>
1268 Av = Af * At</td>
1269 <td style="vertical-align: top;">Rv = Rf*(1-At) + Rt*At<br>
1270 Gv = Gf*(1-At) + Gt*At<br>
1271 Bv = Bf*(1-At) + Bt*At<br>
1272 Av = Af<br>
1273 </td>
1274 <td style="vertical-align: top;">Rv = Rf*(1-Rt) + Rc*Rt<br>
1275 Gv = Gf*(1-Gt) + Gc*Gt<br>
1276 Bv = Bf*(1-Bt) + Bc*Bt<br>
1277 Av = Af*At</td>
1278 </tr>
1279 </tbody>
1280 </table>
1281 <br>
1282 <br>
1283 <br>
1284 <h2>5.5 Texture Objects</h2>
1285 Texture objects encapsulate a set of texture images (mipmap) and
1286 related state into a named object. &nbsp;This facilitates use of
1287 multiple textures in an application. &nbsp;Texture objects are named
1288 with GLuints (unsigned integers). &nbsp;There is a default texture
1289 object with the name/identifier zero which can never be deleted.<br>
1290 <br>
1291 <h3>5.5.1 Creating Texture Objects</h3>
1292 A texture object is created by binding a new GLuint identifier to the
1293 GL_TEXTURE_2D target with the command:<br>
1294 <br>
1295 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glBindTexture</span>(GLenum<span
1296 style="font-style: italic;"> target</span>, GLuint <span
1297 style="font-style: italic;">textureID</span>)<br>
1298 </div>
1299 <br>
1300 <span style="font-style: italic;">target</span> must be GL_TEXTURE_2D.
1301 &nbsp;<span style="font-style: italic;">textureID</span> may be any
1302 unsigned integer. &nbsp;If <span style="font-style: italic;">textureID</span>
1303 does not name an existing texture object, a new texture object with that
1304 ID will be created, initialized to the default state. &nbsp;Whether the
1305 ID is new or existed previously, that named texture object is bound as
1306 the <span style="font-style: italic;">current texture object</span>.
1307 &nbsp;Subsequent <span style="font-weight: bold;">glTexParameter </span>and<span
1308 style="font-weight: bold;">glTexImage2D<span
1309 style="font-style: italic;"> </span></span>calls will effect the
1310 current texture object.<br>
1311 <span style="font-style: italic;"></span><span
1312 style="font-weight: bold;"><span style="font-style: italic;"> </span></span><br>
1313 <h3>5.5.2 Deleting Texture Objects</h3>
1314 One or more texture objects may be deleted with the command:<br>
1315 <br>
1316 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glDeleteTextures</span>(GLsizei<span
1317 style="font-style: italic;">n</span>, const GLuint *<span
1318 style="font-style: italic;">textureIDs</span>)<br>
1319 </div>
1320 <br>
1321 <span style="font-style: italic;">textureIDs</span> is an array of <span
1322 style="font-style: italic;">n</span> texture IDs. &nbsp;The named
1323 texture objects will be deleted. &nbsp;If the current texture object is
1324 deleted the default texture object (number 0) will be bound as the
1325 current texture object.<br>
1326 <br>
1327 <h3>5.5.3 Allocating Texture Object Identifiers</h3>
1328 A list of new, unused texture IDs can be obtained by calling the command<br>
1329 <br>
1330 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glGenTextures</span>(GLsizei<span
1331 style="font-style: italic;"> n</span>, GLuint *<span
1332 style="font-style: italic;">textureIDs</span>)<br>
1333 </div>
1334 <br>
1335 An array of <span style="font-style: italic;">n</span> unused texture
1336 IDs will be returned in the <span style="font-style: italic;">textureIDs</span>
1337 array.<br>
1338 <br>
1339 <br>
1340 <h1>6. Per-fragment Operations</h1>
1341 The fragments produced by rasterization are subjected to a number of
1342 operations which either modify the fragment or test the fragment
1343 (discarding the fragment if the test fails.) &nbsp;This chapter
1344 describes the per-fragment operations. &nbsp;They are presented in the
1345 order in which they're performed. &nbsp;If a fragment fails a test it is
1346 discarded and not subjected to subsequent tests or modifications.<br>
1347 <br>
1348 <h2>6.1 Scissor Test</h2>
1349 The scissor test limits rendering to a 2-D rectangular region of the
1350 framebuffer. &nbsp;The command<br>
1351 <br>
1352 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glScissor</span>(GLint<span
1353 style="font-style: italic;">x</span>, GLint <span
1354 style="font-style: italic;">y</span>, GLsizei <span
1355 style="font-style: italic;">width</span>, GLsizei<span
1356 style="font-style: italic;"> height</span>)<br>
1357 </div>
1358 <br>
1359 defines a clipping region with the lower-left corner at (<span
1360 style="font-style: italic;">x, y</span>) and the given <span
1361 style="font-style: italic;">width</span> and <span
1362 style="font-style: italic;">height</span>. &nbsp;The scissor test is
1363 enabled and disabled with the command <span style="font-weight: bold;">glEnable</span>(GL_SCISSOR_TEST)
1364 and <span style="font-weight: bold;">glDisable</span>(GL_SCISSOR_TEST).<br>
1365 <br>
1366 If the incoming fragment's position is (x<sub>f</sub>, y<sub>f</sub>)
1367 then the fragment will pass the test if <span
1368 style="font-style: italic;">x</span> &lt;= x<sub>f</sub> &lt; <span
1369 style="font-style: italic;">x</span> + <span
1370 style="font-style: italic;">width</span> and <span
1371 style="font-style: italic;">y</span> &lt;= y<sub>f</sub> &lt; <span
1372 style="font-style: italic;">y</span> + <span
1373 style="font-style: italic;">height. &nbsp;</span>Otherwise, the
1374 fragment is discarded.<br>
1375 <br>
1376 If <span style="font-style: italic;">width</span> or <span
1377 style="font-style: italic;">height</span> is less than zero the error
1378 GL_INVALID_VALUE is raised. &nbsp;The default scissor rectangle bounds
1379 are (0, 0, w, h) where w is the initial window width and h is the
1380 initial window height. &nbsp;The scissor test is disabled by default.<br>
1381 <br>
1382 <h2>6.2 Alpha Test</h2>
1383 The alpha test compares the fragment's alpha value against a reference
1384 value and discards the fragment if the comparison fails. &nbsp;The test
1385 is specified by the command<br>
1386 <br>
1387 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glAlphaFunc</span>(GLenum<span
1388 style="font-style: italic;">mode</span>, GLclampf <span
1389 style="font-style: italic;">reference</span>)<br>
1390 </div>
1391 <br>
1392 <span style="font-style: italic;">mode</span> specifies an inequality
1393 and <span style="font-style: italic;">reference</span> specifies a value
1394 to compare against. &nbsp;The following table lists all possible
1395 modes&nbsp;<span style="font-style: italic;"></span>and the
1396 corresponding test:<br>
1397 <br>
1398 <table cellpadding="2" cellspacing="2" border="1"
1399 style="text-align: left; width: 50%; margin-left: auto; margin-right: auto;">
1400 <tbody>
1401 <tr>
1402 <td style="vertical-align: top;">Comparison mode<br>
1403 </td>
1404 <td style="vertical-align: top;">The test passes if<br>
1405 </td>
1406 </tr>
1407 <tr>
1408 <td style="vertical-align: top;">GL_LESS<br>
1409 </td>
1410 <td style="vertical-align: top;">alpha &lt; <span
1411 style="font-style: italic;">reference</span><br>
1412 </td>
1413 </tr>
1414 <tr>
1415 <td style="vertical-align: top;">GL_LEQUAL<br>
1416 </td>
1417 <td style="vertical-align: top;">alpha &lt;= <span
1418 style="font-style: italic;">reference</span></td>
1419 </tr>
1420 <tr>
1421 <td style="vertical-align: top;">GL_GREATER<br>
1422 </td>
1423 <td style="vertical-align: top;">alpha &gt; <span
1424 style="font-style: italic;">reference</span></td>
1425 </tr>
1426 <tr>
1427 <td style="vertical-align: top;">GL_GEQUAL<br>
1428 </td>
1429 <td style="vertical-align: top;">alpha &gt;= <span
1430 style="font-style: italic;">reference</span></td>
1431 </tr>
1432 <tr>
1433 <td style="vertical-align: top;">GL_EQUAL<br>
1434 </td>
1435 <td style="vertical-align: top;">alpha == <span
1436 style="font-style: italic;">reference</span></td>
1437 </tr>
1438 <tr>
1439 <td style="vertical-align: top;">GL_NOTEQUAL<br>
1440 </td>
1441 <td style="vertical-align: top;">alpha != <span
1442 style="font-style: italic;">reference</span></td>
1443 </tr>
1444 <tr>
1445 <td style="vertical-align: top;">GL_NEVER<br>
1446 </td>
1447 <td style="vertical-align: top;">never pass<br>
1448 </td>
1449 </tr>
1450 <tr>
1451 <td style="vertical-align: top;">GL_ALWAYS<br>
1452 </td>
1453 <td style="vertical-align: top;">always passes<br>
1454 </td>
1455 </tr>
1456 </tbody>
1457 </table>
1458 <br>
1459 The <span style="font-style: italic;">reference</span> parameter is
1460 clamped to the range [0, 1].<br>
1461 <br>
1462 The alpha test is enabled and disabled with the commands <span
1463 style="font-weight: bold;">glEnable</span>(GL_ALPHA_TEST) and <span
1464 style="font-weight: bold;">glDisable</span>(GL_ALPHA_TEST).<br>
1465 <br>
1466 The default mode is GL_ALWAYS and the default reference value is 0.<br>
1467 <br>
1468 <h2>6.3 Stencil Test</h2>
1469 The stencil buffer stores an N-bit integer value for each pixel in the
1470 frame buffer. &nbsp;The stencil test compares the stencil buffer value
1471 at the fragment's position to a reference value and possibly discards
1472 the fragment based on the outcome. &nbsp;Furthermore, the stencil buffer
1473 value may be updated or modified depending on the outcome. &nbsp;If
1474 there is no stencil buffer the stencil test is bypassed.<br>
1475 <br>
1476 Stenciling is controlled by the commands<br>
1477 <br>
1478 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glStencilFunc</span>(GLenum<span
1479 style="font-style: italic;">func</span>, GLint <span
1480 style="font-style: italic;">ref</span>, GLuint <span
1481 style="font-style: italic;">mask</span>)<br>
1482 void <span style="font-weight: bold;">glStencilOp</span>(GLenum <span
1483 style="font-style: italic;">stencilFail</span>, GLenum <span
1484 style="font-style: italic;">depthTestFail</span>, GLenum <span
1485 style="font-style: italic;">depthTestPass</span>)<br>
1486 </div>
1487 <br>
1488 The <span style="font-weight: bold;">glStencilFunc<span
1489 style="font-style: italic;"> </span></span>command controls the
1490 stencil test while <span style="font-weight: bold;">glStencilOp</span>
1491 command controls the how the stencil buffer is updated/modified after
1492 the test.<br>
1493 <br>
1494 <span style="font-style: italic;">ref</span> is clamped to the range [0,
1495 2<sup>N</sup>-1] where N is the number of bits per stencil value in the
1496 stencil buffer.<span style="font-style: italic;"></span><br>
1497 <br>
1498 The following table lists all possible values for the <span
1499 style="font-style: italic;">func</span> parameter and when the stencil
1500 test will pass. &nbsp;Both the stencil buffer value and the stencil
1501 reference value are bit-wise ANDed with the <span
1502 style="font-style: italic;">mask</span> parameter before the test.<br>
1503 <br>
1504 <span style="font-style: italic;"></span><span
1505 style="font-style: italic;"></span><span style="font-style: italic;"></span>
1506 <table
1507 style="text-align: left; margin-left: auto; margin-right: auto; width: 70%;"
1508 border="1" cellspacing="2" cellpadding="2">
1509 <tbody>
1510 <tr>
1511 <td style="vertical-align: top;">Stencil <span
1512 style="font-style: italic;">func</span> value<br>
1513 </td>
1514 <td style="vertical-align: top;">Stencil test passes if<br>
1515 </td>
1516 </tr>
1517 <tr>
1518 <td style="vertical-align: top;">GL_LESS<br>
1519 </td>
1520 <td style="vertical-align: top;"><span style="font-style: italic;">(ref</span>&amp;<span
1521 style="font-style: italic;">mask)</span> &lt; (stencil buffer value
1522 &amp; <span style="font-style: italic;">mask)</span><br>
1523 </td>
1524 </tr>
1525 <tr>
1526 <td style="vertical-align: top;">GL_LEQUAL<br>
1527 </td>
1528 <td style="vertical-align: top;"><span style="font-style: italic;">(ref</span>
1529 &amp; <span style="font-style: italic;">mask) </span>&lt;= (stencil
1530 buffer value &amp; <span style="font-style: italic;">mask)</span></td>
1531 </tr>
1532 <tr>
1533 <td style="vertical-align: top;">GL_GREATER<br>
1534 </td>
1535 <td style="vertical-align: top;"><span style="font-style: italic;">(ref</span>
1536 &amp; <span style="font-style: italic;">mask) </span>&gt; (stencil
1537 buffer value &amp; <span style="font-style: italic;">mask)</span></td>
1538 </tr>
1539 <tr>
1540 <td style="vertical-align: top;">GL_GEQUAL<br>
1541 </td>
1542 <td style="vertical-align: top;"><span style="font-style: italic;">(ref</span>
1543 &amp; <span style="font-style: italic;">mask) </span>&gt;= (stencil
1544 buffer value &amp; <span style="font-style: italic;">mask)</span></td>
1545 </tr>
1546 <tr>
1547 <td style="vertical-align: top;">GL_EQUAL<br>
1548 </td>
1549 <td style="vertical-align: top;"><span style="font-style: italic;">(ref</span>
1550 &amp; <span style="font-style: italic;">mask) </span>== (stencil
1551 buffer value &amp; <span style="font-style: italic;">mask)</span></td>
1552 </tr>
1553 <tr>
1554 <td style="vertical-align: top;">GL_NOTEQUAL<br>
1555 </td>
1556 <td style="vertical-align: top;"><span style="font-style: italic;">(ref</span>
1557 &amp; <span style="font-style: italic;">mask) </span>!= (stencil
1558 buffer value &amp; <span style="font-style: italic;">mask)</span></td>
1559 </tr>
1560 <tr>
1561 <td style="vertical-align: top;">GL_NEVER<br>
1562 </td>
1563 <td style="vertical-align: top;">never passes<br>
1564 </td>
1565 </tr>
1566 <tr>
1567 <td style="vertical-align: top;">GL_ALWAYS<br>
1568 </td>
1569 <td style="vertical-align: top;">always passes<br>
1570 </td>
1571 </tr>
1572 </tbody>
1573 </table>
1574 <br>
1575 <span style="font-style: italic;"></span><br>
1576 If the stencil test passes, the fragment is passed to the next
1577 per-fragment operation. &nbsp;Otherwise, if the stencil test fails, the
1578 value in the stencil buffer is updated according to the value of the <span
1579 style="font-style: italic;">stencilFail</span> parameter to <span
1580 style="font-weight: bold;">glStencilOp</span>.<br>
1581 <br>
1582 <table cellpadding="2" cellspacing="2" border="1"
1583 style="text-align: left; width: 70%; margin-left: auto; margin-right: auto;">
1584 <tbody>
1585 <tr>
1586 <td style="vertical-align: top;"><span style="font-style: italic;">stencilFail</span>
1587 value<br>
1588 </td>
1589 <td style="vertical-align: top;">New stencil buffer value<br>
1590 </td>
1591 </tr>
1592 <tr>
1593 <td style="vertical-align: top;">GL_KEEP<br>
1594 </td>
1595 <td style="vertical-align: top;">originalValue<br>
1596 </td>
1597 </tr>
1598 <tr>
1599 <td style="vertical-align: top;">GL_ZERO<br>
1600 </td>
1601 <td style="vertical-align: top;">0<br>
1602 </td>
1603 </tr>
1604 <tr>
1605 <td style="vertical-align: top;">GL_INVERT<br>
1606 </td>
1607 <td style="vertical-align: top;">BitWiseInvert(originalValue)
1608 i.e. ~originalValue<br>
1609 </td>
1610 </tr>
1611 <tr>
1612 <td style="vertical-align: top;">GL_REPLACE<br>
1613 </td>
1614 <td style="vertical-align: top;"><span style="font-style: italic;">ref</span><br>
1615 </td>
1616 </tr>
1617 <tr>
1618 <td style="vertical-align: top;">GL_INCR<br>
1619 </td>
1620 <td style="vertical-align: top;">originalValue + 1, clamped to
1621 [0, 2<sup>N</sup>-1]</td>
1622 </tr>
1623 <tr>
1624 <td style="vertical-align: top;">GL_DECR<br>
1625 </td>
1626 <td style="vertical-align: top;">originalValue - 1, clamped to
1627 [0, 2<sup>N</sup>-1]</td>
1628 </tr>
1629 </tbody>
1630 </table>
1631 <span style="font-style: italic;"></span><span
1632 style="font-style: italic;"></span><br>
1633 <br>
1634 The <span style="font-style: italic;">depthTestFail</span> and <span
1635 style="font-style: italic;">depthTestPass</span> parameters to <span
1636 style="font-weight: bold;">glStencilOp</span> are ignored. &nbsp;Values
1637 for <span style="font-style: italic;">func</span> and <span
1638 style="font-style: italic;">stencilFail</span> other than those listed
1639 in the table will cause the error GL_INVALID_ENUM to be raised.<br>
1640 <br>
1641 The stencil test is enabled and disabled with the commands <span
1642 style="font-weight: bold;">glEnable</span>(GL_STENCIL_TEST) and <span
1643 style="font-weight: bold;">glDisable</span>(GL_STENCIL_TEST).<br>
1644 <br>
1645 The default stencil function is GL_ALWAYS. &nbsp;The default stencil
1646 reference value is 0. &nbsp;The default stencil mask is ~0. &nbsp;The
1647 default stencil fail operation is GL_KEEP.<br>
1648 <br>
1649 Values written into the stencil buffer are masked with the command<br>
1650 <br>
1651 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glStencilMask</span>(GLuint<span
1652 style="font-style: italic;">mask</span>)<br>
1653 </div>
1654 <br>
1655 Only the bits which are set in <span style="font-style: italic;">mask</span>
1656 will be modified in the stencil buffer when written to. &nbsp;If each
1657 stencil buffer value has N bits, only the least significant N bits of <span
1658 style="font-style: italic;">mask</span> are relevant. &nbsp;The default
1659 stencil mask is ~0.<br>
1660 <br>
1661 <h2>6.4 Blending and Logicop</h2>
1662 Blending or a logic operation combines the incoming fragment color with
1663 the destination frame buffer color according to a blending equation or
1664 bit-wise Boolean logical operation.<br>
1665 <br>
1666 Blending is enabled and disabled with the commands <span
1667 style="font-weight: bold;">glEnable</span>(GL_BLEND) and <span
1668 style="font-weight: bold;">glDisable</span>(GL_BLEND).<br>
1669 <br>
1670 The logic operation is enabled and disabled with the commands <span
1671 style="font-weight: bold;">glEnable</span>(GL_LOGIC_OP) and <span
1672 style="font-weight: bold;">glDisable</span>(GL_LOGIC_OP).<br>
1673 <br>
1674 If both blending and the logic operation are enabled, the logic
1675 operation has higher priority; blending is bypassed.<br>
1676 <br>
1677 <h3>6.4.1 Logic Op</h3>
1678 The command<br>
1679 <br>
1680 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glLogicop</span>(GLenum<span
1681 style="font-style: italic;">mode</span>)<br>
1682 <br>
1683 </div>
1684 Specifies the Boolean logic operation for combining the incoming
1685 fragment color with the destination frame buffer color. &nbsp;Both the
1686 incoming fragment color and destination frame buffer colors are
1687 interpreted as four-tuples of unsigned integer color components in the
1688 range [0, 2<sup>N</sup>-1] where N is the number of bits per color
1689 channel. &nbsp;N may not be the same for all color channels.<br>
1690 <br>
1691 The following table lists all values for <span
1692 style="font-style: italic;">mode</span> and the boolean arithmetic used
1693 to combine the incoming fragment color value (src)<span
1694 style="font-style: italic;"></span><span style="font-style: italic;"></span><span
1695 style="font-style: italic;"></span><span style="font-style: italic;"></span><span
1696 style="font-style: italic;"></span> with the destination framebuffer
1697 color value (dst). &nbsp;Standard ANSI C operators used.<br>
1698 <br>
1699 <table cellpadding="2" cellspacing="2" border="1"
1700 style="text-align: left; width: 50%; margin-left: auto; margin-right: auto;">
1701 <tbody>
1702 <tr>
1703 <td style="vertical-align: top;">LogicOp <span
1704 style="font-style: italic;">mode</span><br>
1705 </td>
1706 <td style="vertical-align: top;">Resulting channel value<br>
1707 </td>
1708 </tr>
1709 <tr>
1710 <td style="vertical-align: top;">GL_CLEAR<br>
1711 </td>
1712 <td style="vertical-align: top;">0<br>
1713 </td>
1714 </tr>
1715 <tr>
1716 <td style="vertical-align: top;">GL_SET<br>
1717 </td>
1718 <td style="vertical-align: top;">~0<br>
1719 </td>
1720 </tr>
1721 <tr>
1722 <td style="vertical-align: top;">GL_COPY<br>
1723 </td>
1724 <td style="vertical-align: top;">src<br>
1725 </td>
1726 </tr>
1727 <tr>
1728 <td style="vertical-align: top;">GL_COPY_INVERTED<br>
1729 </td>
1730 <td style="vertical-align: top;">~s<br>
1731 </td>
1732 </tr>
1733 <tr>
1734 <td style="vertical-align: top;">GL_NOOP<br>
1735 </td>
1736 <td style="vertical-align: top;">dst<br>
1737 </td>
1738 </tr>
1739 <tr>
1740 <td style="vertical-align: top;">GL_INVERT<br>
1741 </td>
1742 <td style="vertical-align: top;">~dst<br>
1743 </td>
1744 </tr>
1745 <tr>
1746 <td style="vertical-align: top;">GL_AND<br>
1747 </td>
1748 <td style="vertical-align: top;">src &amp; dst<br>
1749 </td>
1750 </tr>
1751 <tr>
1752 <td style="vertical-align: top;">GL_NAND<br>
1753 </td>
1754 <td style="vertical-align: top;">~(src &amp; dst)<br>
1755 </td>
1756 </tr>
1757 <tr>
1758 <td style="vertical-align: top;">GL_AND_REVERSE<br>
1759 </td>
1760 <td style="vertical-align: top;">src &amp; ~dst<br>
1761 </td>
1762 </tr>
1763 <tr>
1764 <td style="vertical-align: top;">GL_AND_INVERTED<br>
1765 </td>
1766 <td style="vertical-align: top;">~src &amp; dst<br>
1767 </td>
1768 </tr>
1769 <tr>
1770 <td style="vertical-align: top;">GL_OR<br>
1771 </td>
1772 <td style="vertical-align: top;">src | dst<br>
1773 </td>
1774 </tr>
1775 <tr>
1776 <td style="vertical-align: top;">GL_NOR<br>
1777 </td>
1778 <td style="vertical-align: top;">~(src | dst)<br>
1779 </td>
1780 </tr>
1781 <tr>
1782 <td style="vertical-align: top;">GL_OR_REVERSE<br>
1783 </td>
1784 <td style="vertical-align: top;">src | ~dst<br>
1785 </td>
1786 </tr>
1787 <tr>
1788 <td style="vertical-align: top;">GL_OR_INVERTED<br>
1789 </td>
1790 <td style="vertical-align: top;">~src | dst<br>
1791 </td>
1792 </tr>
1793 <tr>
1794 <td style="vertical-align: top;">GL_XOR<br>
1795 </td>
1796 <td style="vertical-align: top;">src ^ dst<br>
1797 </td>
1798 </tr>
1799 <tr>
1800 <td style="vertical-align: top;">GL_EQUIV<br>
1801 </td>
1802 <td style="vertical-align: top;">~(src ^ dst)<br>
1803 </td>
1804 </tr>
1805 </tbody>
1806 </table>
1807 <br>
1808 The fragment's color is replaced by the result of the logic operation.<br>
1809 <br>
1810 Specifying any value for <span style="font-style: italic;">mode</span>
1811 other than those listed in the above table will cause the error
1812 GL_INVALID_ENUM to be raised.<br>
1813 <br>
1814 The default value for <span style="font-style: italic;">mode</span> is
1815 GL_COPY. &nbsp;The logic operation is disabled by default.<br>
1816 <br>
1817 <h3>6.4.2 Blending</h3>
1818 The command<br>
1819 <br>
1820 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glBlendFunc</span>(GLenum<span
1821 style="font-style: italic;">srcTerm</span>, GLenum <span
1822 style="font-style: italic;">dstTerm</span>)<br>
1823 </div>
1824 <br>
1825 specifies the terms of the blending equation. &nbsp;If Cf = (Rf, Gf,
1826 Bf, Af) is the incoming fragment color and Cb = (Rb, Gb, Bb, Ab) is the
1827 frame buffer color, then the resulting color Cv = (Rv, Gv, Bv, Av) is
1828 computed by:<br>
1829 <br>
1830 <div style="margin-left: 40px;">Cv = Cf * <span
1831 style="font-style: italic;">srcTerm</span> + Cb * <span
1832 style="font-style: italic;">dstTerm</span><br>
1833 <span style="font-style: italic;"></span></div>
1834 <span style="font-style: italic;"> </span><br>
1835 All possible values for <span style="font-style: italic;">srcTerm</span>
1836 and the corresponding arithmetic term are listed in the following table:<br>
1837 <br>
1838 <table cellpadding="2" cellspacing="2" border="1"
1839 style="text-align: left; width: 70%; margin-left: auto; margin-right: auto;">
1840 <tbody>
1841 <tr>
1842 <td style="vertical-align: top;"><span style="font-style: italic;">srcTerm</span><br>
1843 </td>
1844 <td style="vertical-align: top;"><span style="font-style: italic;">srcTerm</span>Arithmetic<br>
1845 </td>
1846 </tr>
1847 <tr>
1848 <td style="vertical-align: top;">GL_ZERO<br>
1849 </td>
1850 <td style="vertical-align: top;">(0, 0, 0, 0)<br>
1851 </td>
1852 </tr>
1853 <tr>
1854 <td style="vertical-align: top;">GL_ONE<br>
1855 </td>
1856 <td style="vertical-align: top;">(1, 1, 1, 1)<br>
1857 </td>
1858 </tr>
1859 <tr>
1860 <td style="vertical-align: top;">GL_DST_COLOR<br>
1861 </td>
1862 <td style="vertical-align: top;">(Rb, Gb, Bb, Ab)<br>
1863 </td>
1864 </tr>
1865 <tr>
1866 <td style="vertical-align: top;">GL_ONE_MINUS_DST_COLOR<br>
1867 </td>
1868 <td style="vertical-align: top;">(1-Rb, 1-Gb, 1-Bb, 1-Ab)<br>
1869 </td>
1870 </tr>
1871 <tr>
1872 <td style="vertical-align: top;">GL_SRC_ALPHA<br>
1873 </td>
1874 <td style="vertical-align: top;">(Af, Af, Af, AF)<br>
1875 </td>
1876 </tr>
1877 <tr>
1878 <td style="vertical-align: top;">GL_ONE_MINUS_SRC_ALPHA<br>
1879 </td>
1880 <td style="vertical-align: top;">(1-Af, 1-Af, 1-Af, 1-Af)<br>
1881 </td>
1882 </tr>
1883 <tr>
1884 <td style="vertical-align: top;">GL_DST_ALPHA<br>
1885 </td>
1886 <td style="vertical-align: top;">(Ab, Ab, Ab, Ab)<br>
1887 </td>
1888 </tr>
1889 <tr>
1890 <td style="vertical-align: top;">GL_ONE_MINUS_DST_ALPHA<br>
1891 </td>
1892 <td style="vertical-align: top;">(1-Ab, 1-Ab, 1-Ab, 1-Ab)<br>
1893 </td>
1894 </tr>
1895 <tr>
1896 <td style="vertical-align: top;">GL_SRC_ALPHA_SATURATE<br>
1897 </td>
1898 <td style="vertical-align: top;">(m, m, m, 1) where m = MIN(Af,
1899 1-Ab)<br>
1900 </td>
1901 </tr>
1902 </tbody>
1903 </table>
1904 <br>
1905 All possible values for <span style="font-style: italic;">srcTerm</span>
1906 and the corresponding arithmetic term are listed in the following table:<br>
1907 <br>
1908 <table cellpadding="2" cellspacing="2" border="1"
1909 style="text-align: left; width: 70%; margin-left: auto; margin-right: auto;">
1910 <tbody>
1911 <tr>
1912 <td style="vertical-align: top;"><span style="font-style: italic;">dstTerm</span><br>
1913 </td>
1914 <td style="vertical-align: top;"><span style="font-style: italic;">dstTerm</span>Arithmetic<br>
1915 </td>
1916 </tr>
1917 <tr>
1918 <td style="vertical-align: top;">GL_ZERO<br>
1919 </td>
1920 <td style="vertical-align: top;">(0, 0, 0, 0)<br>
1921 </td>
1922 </tr>
1923 <tr>
1924 <td style="vertical-align: top;">GL_ONE<br>
1925 </td>
1926 <td style="vertical-align: top;">(1, 1, 1, 1)<br>
1927 </td>
1928 </tr>
1929 <tr>
1930 <td style="vertical-align: top;">GL_SRC_COLOR<br>
1931 </td>
1932 <td style="vertical-align: top;">(Rf, Gf, Bf, Af)<br>
1933 </td>
1934 </tr>
1935 <tr>
1936 <td style="vertical-align: top;">GL_ONE_MINUS_SRC_COLOR<br>
1937 </td>
1938 <td style="vertical-align: top;">(1-Rf, 1-Gf, 1-Bf, 1-Af)<br>
1939 </td>
1940 </tr>
1941 <tr>
1942 <td style="vertical-align: top;">GL_SRC_ALPHA<br>
1943 </td>
1944 <td style="vertical-align: top;">(Af, Af, Af, AF)<br>
1945 </td>
1946 </tr>
1947 <tr>
1948 <td style="vertical-align: top;">GL_ONE_MINUS_SRC_ALPHA<br>
1949 </td>
1950 <td style="vertical-align: top;">(1-Af, 1-Af, 1-Af, 1-Af)<br>
1951 </td>
1952 </tr>
1953 <tr>
1954 <td style="vertical-align: top;">GL_DST_ALPHA<br>
1955 </td>
1956 <td style="vertical-align: top;">(Ab, Ab, Ab, Ab)<br>
1957 </td>
1958 </tr>
1959 <tr>
1960 <td style="vertical-align: top;">GL_ONE_MINUS_DST_ALPHA<br>
1961 </td>
1962 <td style="vertical-align: top;">(1-Ab, 1-Ab, 1-Ab, 1-Ab)<br>
1963 </td>
1964 </tr>
1965 </tbody>
1966 </table>
1967 <br>
1968 The fragment's color is replaced by the result of the blending equation.<br>
1969 <br>
1970 Values for <span style="font-style: italic;">srcTerm</span> and <span
1971 style="font-style: italic;">dstTerm</span> other than those listed in
1972 the table will cause the error GL_INVALID_ENUM to be raised.<br>
1973 <br>
1974 The default value for <span style="font-style: italic;">srcTerm</span>
1975 is GL_ONE. &nbsp;The default value for <span style="font-style: italic;">dstTerm</span>
1976 is GL_ZERO. &nbsp;Blending is disabled by default.<br>
1977 <br>
1978 <h2>6.5 Color Mask</h2>
1979 The final fragment color is written into the current color buffer at
1980 the end of the per-fragment operations. &nbsp;Normally, all color
1981 channels in the frame buffer are replaced with the final fragment color.
1982 &nbsp;However, the command<br>
1983 <br>
1984 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glColorMask</span>(GLboolean<span
1985 style="font-style: italic;">redMask</span>, GLboolean <span
1986 style="font-style: italic;">greenMask</span>, GLboolean <span
1987 style="font-style: italic;">blueMask</span>, GLboolean <span
1988 style="font-style: italic;">alphaMask</span>)<br>
1989 </div>
1990 <br>
1991 allows selective writing to individual color channels. &nbsp;If <span
1992 style="font-style: italic;">redMask</span> is GL_TRUE then writing to
1993 the red color channel is enabled, otherwise it's disabled.
1994 &nbsp;Similarly, the green, blue and alpha channels can also be masked.<br>
1995 <br>
1996 Initially all four mask values are GL_TRUE.<br>
1997 <br>
1998 Color masking is not enabled/disabled with the <span
1999 style="font-weight: bold;">glEnable</span>/<span
2000 style="font-weight: bold;">glDisable</span> commands.<br>
2001 <br>
2002 <h1>7. Frame Buffer Operations</h1>
2003 The frame buffer is considered to be a two-dimensional array of pixels.
2004 &nbsp;The frame buffer is also organized into layers or logical buffers.
2005 &nbsp;There may be a front color buffer, back color buffer and stencil
2006 buffer. &nbsp;A double-buffered frame buffer has both a front color
2007 buffer and back color buffer. &nbsp;A single-buffered framebuffer only
2008 has a front color buffer. &nbsp;Each pixel in a color buffer has a red,
2009 green and blue value and an optional alpha value.<br>
2010 <br>
2011 <h2>7.1 Clearing Buffers</h2>
2012 Buffers are cleared (set to uniform values) with the command<br>
2013 <br>
2014 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glClear</span>(GLbitfield<span
2015 style="font-style: italic;">buffers</span>)<br>
2016 </div>
2017 <br>
2018 <span style="font-style: italic;">buffers</span> is a bitmask for which
2019 the value may be the bitwise-OR of the values GL_COLOR_BUFFER_BIT and
2020 GL_STENCIL_BUFFER_BIT. &nbsp;If the GL_COLOR_BUFFER_BIT bit is
2021 specified, the current color buffer will be cleared. &nbsp;If the
2022 GL_STENCIL_BUFFER_BIT bit is specified, the stencil buffer will be
2023 cleared.<br>
2024 <br>
2025 The current color buffer is specified with the command<br>
2026 <br>
2027 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glDrawBuffer</span>(GLenum<span
2028 style="font-style: italic;"> buffer</span>)<br>
2029 </div>
2030 <br>
2031 <span style="font-style: italic;">buffer</span> may be either GL_FRONT,
2032 GL_BACK or GL_NONE. &nbsp;GL_FRONT indicates that the front color buffer
2033 will be modified by <span style="font-weight: bold;">glClear</span> and
2034 any drawing command. &nbsp;GL_BACK indicates that the back color buffer
2035 will be modified by <span style="font-weight: bold;">glClear</span> and
2036 any drawing command. &nbsp;GL_NONE indicates that neither color buffer
2037 will be modified by <span style="font-weight: bold;">glClear</span> or
2038 any drawing command. &nbsp;GL_BACK is only valid for double-buffered
2039 frame buffers.<br>
2040 <br>
2041 The current scissor rectangle, set by the <span
2042 style="font-weight: bold;">glScissor</span> command, effects <span
2043 style="font-weight: bold;">glClear</span><span
2044 style="font-style: italic;">,</span><span style="font-style: italic;"> </span>limiting
2045 the clear to the scissor rectangle, if it's enabled. &nbsp;Furthermore, <span
2046 style="font-weight: bold;"></span>only the color channels enabled by <span
2047 style="font-weight: bold;">glColorMask</span> will be effected by <span
2048 style="font-weight: bold;">glClear</span>(GL_COLOR_BUFFER_BIT).
2049 &nbsp;Likewise, only the stencil bits enabled by <span
2050 style="font-weight: bold;">glStencilMask</span> will be effected by <span
2051 style="font-weight: bold;">glClear</span>(GL_STENCIL_BUFFER_BIT).<br>
2052 <br>
2053 The current clear color is set with the command<br>
2054 <br>
2055 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glClearColor</span>(GLclampf<span
2056 style="font-style: italic;">red</span>, GLclampf <span
2057 style="font-style: italic;">green</span>, GLclampf <span
2058 style="font-style: italic;">blue</span>, GLclampf <span
2059 style="font-style: italic;">alpha</span>)<br>
2060 </div>
2061 <br>
2062 Subsequent calls to <span style="font-weight: bold;">glClear</span>
2063 will use the color (<span style="font-style: italic;">red, green, blue,
2064 alpha</span>) to clear the front or back color buffers.<br>
2065 <span style="font-style: italic;"></span><br>
2066 The current stencil clear value is set with the command<br>
2067 <br>
2068 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glClearStencil</span>(GLint<span
2069 style="font-style: italic;">clearValue</span>)<br>
2070 </div>
2071 <br>
2072 If the stencil buffer is N bits deep, the least significant N bits of <span
2073 style="font-style: italic;">clearValue</span> will be used to clear the
2074 stencil buffer.<br>
2075 <br>
2076 <br>
2077 <h1>8. Other Features</h1>
2078 <h2>8.1 Frame Buffer Readback</h2>
2079 A rectangular region of pixels can be read from the frame buffer and
2080 placed in client memory with the command<br>
2081 <br>
2082 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glReadPixels</span>(GLint<span
2083 style="font-style: italic;">x</span>, GLint <span
2084 style="font-style: italic;">y</span>, GLsizei <span
2085 style="font-style: italic;">width</span>, GLsizei <span
2086 style="font-style: italic;">height</span>, GLenum <span
2087 style="font-style: italic;">format</span>, GLenum <span
2088 style="font-style: italic;">type</span>, GLvoid *<span
2089 style="font-style: italic;">data</span>)<br>
2090 </div>
2091 <br>
2092 <span style="font-style: italic;">x</span> and <span
2093 style="font-style: italic;">y</span> specify the coordinate of the
2094 lower-left corner of the region to read and <span
2095 style="font-style: italic;">width</span> and <span
2096 style="font-style: italic;">height</span> specify the size of the
2097 rectangular region to read. &nbsp;<span style="font-style: italic;">format</span>
2098 specifies the format of image data and must be either GL_RGB or
2099 GL_RGBA.&nbsp; <span style="font-style: italic;">type</span> specify the
2100 data type of the image data and must be either GL_UNSIGNED_BYTE or
2101 GL_FLOAT. &nbsp;Other values for <span style="font-style: italic;">format</span>
2102 or <span style="font-style: italic;">type</span> will cause the error
2103 GL_INVALID_ENUM to be raised.<br>
2104 <br>
2105 The framebuffer may contain 3-component colors (red, green, blue) or
2106 4-component colors (red, green, blue, alpha). &nbsp;If an alpha channel
2107 is not present, alpha values default to 1.0.<br>
2108 <br>
2109 The frame buffer color components (red, green, blue, alpha) are either
2110 converted to 8-bit unsigned integers in the range[0, 255] if <span
2111 style="font-style: italic;">type </span>is GL_UNSIGNED_BYTE or
2112 converted to floating point values in the range [0, 1] if <span
2113 style="font-style: italic;">type</span> is GL_FLOAT. &nbsp;The (red,
2114 green, blue, alpha) tuples are then stored as GL_RGB triplets (by
2115 dropping the alpha component) or GL_RGBA quadruples in client memory.<br>
2116 <br>
2117 Image data is <span style="font-style: italic;">packed</span> into
2118 client memory according to the pixel packing parameters which are set by
2119 the command<br>
2120 <br>
2121 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glPixelStorei</span>(GLenum<span
2122 style="font-style: italic;"> pname</span>, GLint <span
2123 style="font-style: italic;">value</span>)<br>
2124 </div>
2125 <br>
2126 <span style="font-style: italic;">pname</span> must be
2127 GL_PACK_ROW_LENGTH. &nbsp;<span style="font-style: italic;">value</span>
2128 indicates the stride (in pixels) between subsequent rows in the
2129 destination image. &nbsp;If GL_PACK_ROW_LENGTH is zero (the default)
2130 then the <span style="font-style: italic;">width</span> parameter to <span
2131 style="font-weight: bold;">glReadPixels</span> indicates the row stride.<br>
2132 <br>
2133 Pixel readback takes place as follows:<br>
2134 <br>
2135 <div style="margin-left: 40px;">if (GL_PACK_ROW_LENGTH == 0)<br>
2136 &nbsp;&nbsp;&nbsp; rowLength = <span style="font-style: italic;">width</span>;<br>
2137 else<br>
2138 &nbsp;&nbsp;&nbsp; rowLength = GL_PACK_ROW_LENGTH<br>
2139 <br>
2140 if (<span style="font-style: italic;">format</span> == GL_RGB) {<br>
2141 &nbsp;&nbsp;&nbsp; for (i = 0; i &lt; <span style="font-style: italic;">height</span>;
2142 i++) {<br>
2143 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (j = 0; j &lt; <span
2144 style="font-style: italic;">width</span>; j++) {<br>
2145 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; k = (i *
2146 rowLength + j) * 3;<br>
2147 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span
2148 style="font-style: italic;">data</span>[k+0] = FrameBuffer(<span
2149 style="font-style: italic;">x</span> + j, <span
2150 style="font-style: italic;">y</span> + i).red;<br>
2151 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; <span
2152 style="font-style: italic;">data</span>[k+1] = FrameBuffer(<span
2153 style="font-style: italic;">x</span> + j, <span
2154 style="font-style: italic;">y</span> + i).green;<br>
2155 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span
2156 style="font-style: italic;">data</span>[k+2] = FrameBuffer(<span
2157 style="font-style: italic;">x</span> + j, <span
2158 style="font-style: italic;">y</span> + i).blue;<span
2159 style="font-style: italic;"></span><br>
2160 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
2161 &nbsp;&nbsp;&nbsp; }<br>
2162 }<br>
2163 else {<br>
2164 &nbsp;&nbsp;&nbsp; for (i = 0; i &lt; <span style="font-style: italic;">height</span>;
2165 i++) {<br>
2166 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (j = 0; j &lt; <span
2167 style="font-style: italic;">width</span>; j++) {<br>
2168 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; k = (i *
2169 rowLength + j) * 4;<br>
2170 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span
2171 style="font-style: italic;">data</span>[k+0] = FrameBuffer(<span
2172 style="font-style: italic;">x</span> + j, <span
2173 style="font-style: italic;">y</span> + i).red;<br>
2174 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; <span
2175 style="font-style: italic;">data</span>[k+1] = FrameBuffer(<span
2176 style="font-style: italic;">x</span> + j, <span
2177 style="font-style: italic;">y</span> + i).green;<br>
2178 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span
2179 style="font-style: italic;">data</span>[k+2] = FrameBuffer(<span
2180 style="font-style: italic;">x</span> + j, <span
2181 style="font-style: italic;">y</span> + i).blue;<span
2182 style="font-style: italic;"></span><br>
2183 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span
2184 style="font-style: italic;">data</span>[k+3] = FrameBuffer(<span
2185 style="font-style: italic;">x</span> + j, <span
2186 style="font-style: italic;">y</span> + i).alpha;<span
2187 style="font-style: italic;"></span><br>
2188 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
2189 &nbsp;&nbsp;&nbsp; }<br>
2190 }<br>
2191 </div>
2192 <br>
2193 The function FrameBuffer(<span style="font-style: italic;">c, r</span>)
2194 returns the pixel in the frame buffer at column <span
2195 style="font-style: italic;">c</span> of row <span
2196 style="font-style: italic;">r. &nbsp;</span><span
2197 style="font-style: italic;">data</span> is considered to be either a
2198 GLubyte pointer or a GLfloat pointer, depending on the <span
2199 style="font-style: italic;">type</span> parameter. &nbsp;Similarly, the
2200 FrameBuffer function returns either GLubyte values in the range [0, 255]
2201 or GLfloat values in the range [0,1], depending on the <span
2202 style="font-style: italic;">type</span> parameter.<br>
2203 <br>
2204 Pixels may be read from either the front or back color buffer.
2205 &nbsp;The command<br>
2206 <br>
2207 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glReadBuffer</span>(GLenum<span
2208 style="font-style: italic;">buffer</span>)<br>
2209 </div>
2210 <br>
2211 specifies the source for reading images with <span
2212 style="font-weight: bold;">glReadPixels</span>. &nbsp;If <span
2213 style="font-style: italic;">buffer</span> is GL_FRONT then front color
2214 buffer is the source. &nbsp;If <span style="font-style: italic;">buffer</span>
2215 is GL_BACK then the back color buffer is the source. &nbsp;It is illegal
2216 to specify GL_BACK when the color buffer is not double buffered.
2217 &nbsp;Any invalid value for <span style="font-style: italic;">buffer</span>
2218 will raise the error GL_INVALID_ENUM.<br>
2219 <br>
2220 The default read source is GL_BACK if the frame buffer is double
2221 buffered. &nbsp;Otherwise, the default read source is GL_FRONT.<br>
2222 <br>
2223 <h2>8.2 Selection Mode</h2>
2224 Selection mode is typically used to implement <span
2225 style="font-style: italic;">picking</span>: determining which
2226 primitive(s) are present at particular window positions. &nbsp;The
2227 command<br>
2228 <br>
2229 <div style="margin-left: 40px;">GLint <span style="font-weight: bold;">glRenderMode</span>(GLenum<span
2230 style="font-style: italic;">mode</span>)<br>
2231 </div>
2232 <br>
2233 is used to enable selection mode. &nbsp;If <span
2234 style="font-style: italic;">mode</span> is GL_SELECTION the graphics
2235 library is put into selection mode. &nbsp;If <span
2236 style="font-style: italic;">mode</span> is GL_RENDER the graphic
2237 library is put into normal rendering mode. &nbsp;Any other value for <span
2238 style="font-style: italic;">mode</span> will raise the error
2239 GL_INVALID_ENUM.<br>
2240 <br>
2241 When in selection mode rendering commands will not effect the
2242 framebuffer. &nbsp;Instead, a record of the primitives that would have
2243 been drawn is placed in the <span style="font-style: italic;">selection</span> <span
2244 style="font-style: italic;">buffer</span>. &nbsp;The selection buffer
2245 is specified with the command<br>
2246 <br>
2247 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glSelectionBuffer</span>(GLsizei<span
2248 style="font-style: italic;">n</span>, GLuint *<span
2249 style="font-style: italic;">buffer</span>)<br>
2250 </div>
2251 <span style="font-style: italic;"></span><span
2252 style="font-style: italic;"><br>
2253 buffer</span> is an array of <span style="font-style: italic;">n</span>
2254 unsigned integers. &nbsp;No more than <span style="font-style: italic;">n</span>
2255 values will be placed in the buffer.<br>
2256 <br>
2257 The <span style="font-style: italic;">name stack</span> is a stack
2258 (LIFO) of unsigned integer names. &nbsp;The following commands
2259 manipulate the name stack:<br>
2260 <br>
2261 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glInitNames</span>(void)<br>
2262 void <span style="font-weight: bold;">glPushName</span>(GLuint <span
2263 style="font-style: italic;">name</span>)<br>
2264 void <span style="font-weight: bold;">glPopName</span>(void)<br>
2265 void <span style="font-weight: bold;">glLoadName</span>(GLuint <span
2266 style="font-style: italic;">name</span>)<br>
2267 </div>
2268 <br>
2269 <span style="font-weight: bold;">glInitNames</span> resets the name
2270 stack to an empty state. &nbsp;<span style="font-weight: bold;">glPushName<span
2271 style="font-style: italic;"> </span></span>pushes the given <span
2272 style="font-style: italic;">name</span> value onto the stack. &nbsp;<span
2273 style="font-weight: bold;">glPopName</span> pops the top name from the
2274 stack. &nbsp;<span style="font-weight: bold;">glLoadName<span
2275 style="font-style: italic;"> </span></span>replaces the top value on
2276 the stack with the specified <span style="font-style: italic;">name</span>.
2277 &nbsp;Stack underflow and overflow conditions cause the errors
2278 GL_STACK_OVERFLOW and GL_STACK_UNDERFLOW to be raised.<br>
2279 <br>
2280 While in selection mode, primitives (points, lines, polygons) are
2281 transformed and clip-tested normally. &nbsp;Primitives which aren't
2282 discarded by clipping cause the <span style="font-style: italic;">hit</span> <span
2283 style="font-style: italic;">data</span> to be updated. &nbsp;The hit
2284 data consists of three pieces of information: a hit flag, a minimum Z
2285 value and a maximum Z value. &nbsp;First, the hit flag is set.
2286 &nbsp;Then, for each of the primitive's vertices, the vertex Z value is
2287 compared to the minimum and maximum Z values. &nbsp;The minimum Z value
2288 is updated if the vertex's Z value is less than the minimum Z value.
2289 &nbsp;The maximum Z value is updated if the vertex's Z value is greater
2290 than the maximum Z value.<br>
2291 <br>
2292 When any of <span style="font-weight: bold;">glInitNames</span><span
2293 style="font-style: italic;"><span style="font-style: italic;">, </span></span><span
2294 style="font-weight: bold;">glPushName</span>, <span
2295 style="font-weight: bold;">glPopName</span>, <span
2296 style="font-weight: bold;">glLoadName</span> or <span
2297 style="font-weight: bold;">glRenderMode</span> are called and the hit
2298 flag is set, a <span style="font-style: italic;">hit record</span> is
2299 written to the selection buffer.<br>
2300 <br>
2301 A hit record consists of a sequence of unsigned integers. &nbsp;The
2302 first value is the size of the name stack. &nbsp;The second value is the
2303 minimum Z value multiplied by 2<sup>32</sup>-1. &nbsp;The third value is
2304 the maximum Z value multiplied by 2<sup>32</sup>-1. &nbsp;The remaining
2305 values are the values in the name stack, in bottom to top order.
2306 &nbsp;The hit flag is cleared after a hit record is written to the
2307 selection buffer. &nbsp;Hit records are places sequentially into the
2308 selection buffer until it is full or selection mode is terminated.<br>
2309 <br>
2310 Selection mode is terminated by calling <span
2311 style="font-weight: bold;">glRenderMode</span>(GL_RENDER). &nbsp; The
2312 return value of <span style="font-weight: bold;">glRenderMode</span>
2313 will be -1 if the selection buffer overflowed. &nbsp;Otherwise, the
2314 return value will indicate the number of values written into the
2315 selection buffer.<br>
2316 <br>
2317 <h2>8.3 Synchronization</h2>
2318 The command<br>
2319 <br>
2320 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glFlush</span>(void)<br>
2321 </div>
2322 <br>
2323 makes the graphics library to flush all pending graphics commands.
2324 &nbsp;The command<br>
2325 <div style="margin-left: 40px;"><br>
2326 void <span style="font-weight: bold;">glFinish</span>(void)<br>
2327 </div>
2328 <br>
2329 makes the graphics library flush the command queue and wait until those
2330 commands are completed. &nbsp;<span style="font-weight: bold;">glFlush</span>
2331 will not return until all previous graphics commands have been fully
2332 completed.<br>
2333 <br>
2334 These commands are typically used to force completion of rendering to
2335 the front color buffer. &nbsp;Otherwise, rendering to the front color
2336 buffer may not appear. &nbsp;The <span style="font-style: italic;">swapbuffers</span>
2337 command (part of the window system binding library) does an implicit
2338 flush before swapping the front and back color buffers. &nbsp;The <span
2339 style="font-weight: bold;">glReadPixels</span> command also does an
2340 implicit flush before reading pixel data from the frame buffer.<br>
2341 <br>
2342 <h1>9. State Queries</h1>
2343 The current value of nearly all library state variables can be queried.
2344 &nbsp;This chapter describes the commands used for querying the value of
2345 state variables.<br>
2346 <br>
2347 <h2>9.1 General State Queries</h2>
2348 The command<br>
2349 <br>
2350 <div style="margin-left: 40px;">void <span style="font-weight: bold;">glGetFloatv</span>(GLenum<span
2351 style="font-style: italic;">pname</span>, GLfloat *<span
2352 style="font-style: italic;">values</span>)<br>
2353 </div>
2354 <br>
2355 returns the value(s) of the state variable specified by <span
2356 style="font-style: italic;">pname</span>. &nbsp;The following table
2357 lists all accepted values for <span style="font-style: italic;">pname</span>
2358 and a description of the value(s). &nbsp;Specifying any other value for <span
2359 style="font-style: italic;">pname</span> causes the error
2360 GL_INVALID_ENUM to be raised.<br>
2361 <br>
2362 <table cellpadding="2" cellspacing="2" border="1"
2363 style="text-align: left; width: 90%; margin-left: auto; margin-right: auto;">
2364 <tbody>
2365 <tr>
2366 <td style="vertical-align: top;">Variable (<span
2367 style="font-style: italic;">pname)</span><br>
2368 </td>
2369 <td style="vertical-align: top;">Number of values<br>
2370 </td>
2371 <td style="vertical-align: top;">Value(s) Description<br>
2372 </td>
2373 </tr>
2374 <tr>
2375 <td style="vertical-align: top;">GL_ALPHA_BITS<br>
2376 </td>
2377 <td style="vertical-align: top;">1<br>
2378 </td>
2379 <td style="vertical-align: top;">Number of bits per alpha value
2380 in the frame buffer.<br>
2381 </td>
2382 </tr>
2383 <tr>
2384 <td style="vertical-align: top;">GL_ALPHA_TEST<br>
2385 </td>
2386 <td style="vertical-align: top;">1<br>
2387 </td>
2388 <td style="vertical-align: top;">Zero if the alpha test is
2389 disabled.<br>
2390 One if the alpha test is enabled.<br>
2391 </td>
2392 </tr>
2393 <tr>
2394 <td style="vertical-align: top;">GL_ALPHA_TEST_FUNC<br>
2395 </td>
2396 <td style="vertical-align: top;">1<br>
2397 </td>
2398 <td style="vertical-align: top;">The alpha test function.<br>
2399 </td>
2400 </tr>
2401 <tr>
2402 <td style="vertical-align: top;">GL_BLEND<br>
2403 </td>
2404 <td style="vertical-align: top;">1<br>
2405 </td>
2406 <td style="vertical-align: top;">Zero if blending is disabled.<br>
2407 One if blending is enabled.<br>
2408 </td>
2409 </tr>
2410 <tr>
2411 <td style="vertical-align: top;">GL_BLEND_DST<br>
2412 </td>
2413 <td style="vertical-align: top;">1<br>
2414 </td>
2415 <td style="vertical-align: top;">Blend destination function/term.<br>
2416 </td>
2417 </tr>
2418 <tr>
2419 <td style="vertical-align: top;">GL_BLEND_SRC<br>
2420 </td>
2421 <td style="vertical-align: top;">1<br>
2422 </td>
2423 <td style="vertical-align: top;">Blend source function/term.<br>
2424 </td>
2425 </tr>
2426 <tr>
2427 <td style="vertical-align: top;">GL_BLUE_BITS<br>
2428 </td>
2429 <td style="vertical-align: top;">1<br>
2430 </td>
2431 <td style="vertical-align: top;">Number of bits per blue value in
2432 the frame buffer.<br>
2433 </td>
2434 </tr>
2435 <tr>
2436 <td style="vertical-align: top;">GL_COLOR_CLEAR_VALUE<br>
2437 </td>
2438 <td style="vertical-align: top;">4<br>
2439 </td>
2440 <td style="vertical-align: top;">Clear color (red, green, blue,
2441 alpha).<br>
2442 </td>
2443 </tr>
2444 <tr>
2445 <td style="vertical-align: top;">GL_COLOR_WRITE_MASK<br>
2446 </td>
2447 <td style="vertical-align: top;">4<br>
2448 </td>
2449 <td style="vertical-align: top;">Color buffer writemask (red,
2450 green, blue, alpha).<br>
2451 Zero if writing is disabled.<br>
2452 One if writing is enabled.<br>
2453 </td>
2454 </tr>
2455 <tr>
2456 <td style="vertical-align: top;">GL_CULL_FACE<br>
2457 </td>
2458 <td style="vertical-align: top;">1<br>
2459 </td>
2460 <td style="vertical-align: top;">Zero if polygon culling is
2461 disabled.<br>
2462 One if polygon culling is enabled.<br>
2463 </td>
2464 </tr>
2465 <tr>
2466 <td style="vertical-align: top;">GL_CULL_FACE_MODE<br>
2467 </td>
2468 <td style="vertical-align: top;">1<br>
2469 </td>
2470 <td style="vertical-align: top;">Polygon cull mode: GL_FRONT,
2471 GL_BACK or GL_FRONT_AND_BACK.<br>
2472 </td>
2473 </tr>
2474 <tr>
2475 <td style="vertical-align: top;">GL_CURRENT_COLOR<br>
2476 </td>
2477 <td style="vertical-align: top;">4<br>
2478 </td>
2479 <td style="vertical-align: top;">Current color (red, green, blue,
2480 alpha).<br>
2481 </td>
2482 </tr>
2483 <tr>
2484 <td style="vertical-align: top;">GL_CURRENT_RASTER_COLOR<br>
2485 </td>
2486 <td style="vertical-align: top;">4<br>
2487 </td>
2488 <td style="vertical-align: top;">Current raster position color
2489 (red, green, blue, alpha).<br>
2490 </td>
2491 </tr>
2492 <tr>
2493 <td style="vertical-align: top;">GL_CURRENT_RASTER_TEXTURE_COORDS<br>
2494 </td>
2495 <td style="vertical-align: top;">4<br>
2496 </td>
2497 <td style="vertical-align: top;">Current raster position texture
2498 coordinates (s, t, r, q).<br>
2499 </td>
2500 </tr>
2501 <tr>
2502 <td style="vertical-align: top;">GL_CURRENT_RASTER_POSITION<br>
2503 </td>
2504 <td style="vertical-align: top;">4<br>
2505 </td>
2506 <td style="vertical-align: top;">Current raster position (x, y,
2507 z, w).<br>
2508 </td>
2509 </tr>
2510 <tr>
2511 <td style="vertical-align: top;">GL_CURRENT_POSITION_VALID<br>
2512 </td>
2513 <td style="vertical-align: top;">1<br>
2514 </td>
2515 <td style="vertical-align: top;">Zero if current raster position
2516 is invalid.<br>
2517 One if current raster position is valid.<br>
2518 </td>
2519 </tr>
2520 <tr>
2521 <td style="vertical-align: top;">GL_CURRENT_TEXTURE_COORDS<br>
2522 </td>
2523 <td style="vertical-align: top;">4<br>
2524 </td>
2525 <td style="vertical-align: top;">Current texture coordinates (s,
2526 t, r, q)<br>
2527 </td>
2528 </tr>
2529 <tr>
2530 <td style="vertical-align: top;">GL_DOUBLEBUFFER<br>
2531 </td>
2532 <td style="vertical-align: top;">1<br>
2533 </td>
2534 <td style="vertical-align: top;">Zero if color buffer is
2535 single-buffered.<br>
2536 One if color buffer is double-buffered.<br>
2537 </td>
2538 </tr>
2539 <tr>
2540 <td style="vertical-align: top;">GL_DRAW_BUFFER<br>
2541 </td>
2542 <td style="vertical-align: top;">1<br>
2543 </td>
2544 <td style="vertical-align: top;">Current color draw buffer:
2545 GL_FRONT or GL_BACK.<br>
2546 </td>
2547 </tr>
2548 <tr>
2549 <td style="vertical-align: top;">GL_FRONT_FACE</td>
2550 <td style="vertical-align: top;">1<br>
2551 </td>
2552 <td style="vertical-align: top;">Polygon front-face winding:
2553 GL_CW or GL_CCW.<br>
2554 </td>
2555 </tr>
2556 <tr>
2557 <td style="vertical-align: top;">GL_GREEN_BITS<br>
2558 </td>
2559 <td style="vertical-align: top;">1<br>
2560 </td>
2561 <td style="vertical-align: top;">Number of bits per green value
2562 in the frame buffer.<br>
2563 </td>
2564 </tr>
2565 <tr>
2566 <td style="vertical-align: top;">GL_LINE_SMOOTH<br>
2567 </td>
2568 <td style="vertical-align: top;">1<br>
2569 </td>
2570 <td style="vertical-align: top;">Zero if line smoothing is
2571 disabled.<br>
2572 One if line smoothing is enabled.<br>
2573 </td>
2574 </tr>
2575 <tr>
2576 <td style="vertical-align: top;">GL_LINE_STIPPLE<br>
2577 </td>
2578 <td style="vertical-align: top;">1<br>
2579 </td>
2580 <td style="vertical-align: top;">Zero if line stippling is
2581 disabled.<br>
2582 One if line stippling is enabled.<br>
2583 </td>
2584 </tr>
2585 <tr>
2586 <td style="vertical-align: top;">GL_LINE_STIPPLE_PATTERN<br>
2587 </td>
2588 <td style="vertical-align: top;">1<br>
2589 </td>
2590 <td style="vertical-align: top;">Line stipple pattern.<br>
2591 </td>
2592 </tr>
2593 <tr>
2594 <td style="vertical-align: top;">GL_LINE_STIPPLE_REPEAT<br>
2595 </td>
2596 <td style="vertical-align: top;">1<br>
2597 </td>
2598 <td style="vertical-align: top;">Line stipple repeat factor.<br>
2599 </td>
2600 </tr>
2601 <tr>
2602 <td style="vertical-align: top;">GL_LINE_WIDTH<br>
2603 </td>
2604 <td style="vertical-align: top;">1<br>
2605 </td>
2606 <td style="vertical-align: top;">Line width in pixels.<br>
2607 </td>
2608 </tr>
2609 <tr>
2610 <td style="vertical-align: top;">GL_LINE_WIDTH_GRANULARITY<br>
2611 </td>
2612 <td style="vertical-align: top;">1<br>
2613 </td>
2614 <td style="vertical-align: top;">Aliased line width granularity.<br>
2615 </td>
2616 </tr>
2617 <tr>
2618 <td style="vertical-align: top;">GL_LINE_WIDTH_RANGE<br>
2619 </td>
2620 <td style="vertical-align: top;">2<br>
2621 </td>
2622 <td style="vertical-align: top;">Minimum and maximum aliased line
2623 widths.<br>
2624 </td>
2625 </tr>
2626 <tr>
2627 <td style="vertical-align: top;">GL_ALIASED_LINE_WIDTH_RANGE<br>
2628 </td>
2629 <td style="vertical-align: top;">2<br>
2630 </td>
2631 <td style="vertical-align: top;">Minimum and maximum antialiased
2632 line widths.</td>
2633 </tr>
2634 <tr>
2635 <td style="vertical-align: top;">GL_COLOR_LOGIC_OP<br>
2636 </td>
2637 <td style="vertical-align: top;">1<br>
2638 </td>
2639 <td style="vertical-align: top;">Zero if logicop is disabled.<br>
2640 One if logicop is enabled.<br>
2641 </td>
2642 </tr>
2643 <tr>
2644 <td style="vertical-align: top;">GL_LOGIC_OP_MODE<br>
2645 </td>
2646 <td style="vertical-align: top;">1<br>
2647 </td>
2648 <td style="vertical-align: top;">Logicop function.<br>
2649 </td>
2650 </tr>
2651 <tr>
2652 <td style="vertical-align: top;">GL_MATRIX_MODE<br>
2653 </td>
2654 <td style="vertical-align: top;">1<br>
2655 </td>
2656 <td style="vertical-align: top;">Matrix mode: GL_MODELVIEW or
2657 GL_PROJECTION.<br>
2658 </td>
2659 </tr>
2660 <tr>
2661 <td style="vertical-align: top;">GL_MAX_MODELVIEW_STACK_DEPTH<br>
2662 </td>
2663 <td style="vertical-align: top;">1<br>
2664 </td>
2665 <td style="vertical-align: top;">Maximum size of the modelview
2666 matrix stack.<br>
2667 </td>
2668 </tr>
2669 <tr>
2670 <td style="vertical-align: top;">GL_MAX_NAME_STACK_DEPTH<br>
2671 </td>
2672 <td style="vertical-align: top;">1<br>
2673 </td>
2674 <td style="vertical-align: top;">Maximum size of the selection
2675 name stack.<br>
2676 </td>
2677 </tr>
2678 <tr>
2679 <td style="vertical-align: top;">GL_MAX_PROJECTION_STACK_DEPTH<br>
2680 </td>
2681 <td style="vertical-align: top;">1<br>
2682 </td>
2683 <td style="vertical-align: top;">Maximum size of the projection
2684 matrix stack.<br>
2685 </td>
2686 </tr>
2687 <tr>
2688 <td style="vertical-align: top;">GL_MAX_TEXTURE_SIZE<br>
2689 </td>
2690 <td style="vertical-align: top;">1<br>
2691 </td>
2692 <td style="vertical-align: top;">Maximum 2D texture image width
2693 and height.<br>
2694 </td>
2695 </tr>
2696 <tr>
2697 <td style="vertical-align: top;">GL_MAX_VIEWPORT_DIMS<br>
2698 </td>
2699 <td style="vertical-align: top;">2</td>
2700 <td style="vertical-align: top;">Maximum viewport width and
2701 height in pixels.<br>
2702 </td>
2703 </tr>
2704 <tr>
2705 <td style="vertical-align: top;">GL_MODELVIEW_MATRIX<br>
2706 </td>
2707 <td style="vertical-align: top;">16<br>
2708 </td>
2709 <td style="vertical-align: top;">Current/top modelview matrix
2710 values.<br>
2711 </td>
2712 </tr>
2713 <tr>
2714 <td style="vertical-align: top;">GL_MODELVIEW_MATRIX_STACK_DEPTH<br>
2715 </td>
2716 <td style="vertical-align: top;">1<br>
2717 </td>
2718 <td style="vertical-align: top;">Current size of the modelview
2719 matrix stack.<br>
2720 </td>
2721 </tr>
2722 <tr>
2723 <td style="vertical-align: top;">GL_NAME_STACK_DEPTH<br>
2724 </td>
2725 <td style="vertical-align: top;">1<br>
2726 </td>
2727 <td style="vertical-align: top;">Current size of the selection
2728 name stack.<br>
2729 </td>
2730 </tr>
2731 <tr>
2732 <td style="vertical-align: top;">GL_PACK_ROW_LENGTH<br>
2733 </td>
2734 <td style="vertical-align: top;">1<br>
2735 </td>
2736 <td style="vertical-align: top;">Pixel packing row length.<br>
2737 </td>
2738 </tr>
2739 <tr>
2740 <td style="vertical-align: top;">GL_POLYGON_SMOOTH<br>
2741 </td>
2742 <td style="vertical-align: top;">1<br>
2743 </td>
2744 <td style="vertical-align: top;">Zero if polygon smoothing is
2745 disabled.<br>
2746 One if polygon smoothing is enabled.<br>
2747 </td>
2748 </tr>
2749 <tr>
2750 <td style="vertical-align: top;">GL_PROJECTION_MATRIX<br>
2751 </td>
2752 <td style="vertical-align: top;">16<br>
2753 </td>
2754 <td style="vertical-align: top;">Current/top projection matrix
2755 values.<br>
2756 </td>
2757 </tr>
2758 <tr>
2759 <td style="vertical-align: top;">GL_PROJECTION_STACK_DEPTH<br>
2760 </td>
2761 <td style="vertical-align: top;">1<br>
2762 </td>
2763 <td style="vertical-align: top;">Current size of projection
2764 matrix stack.<br>
2765 </td>
2766 </tr>
2767 <tr>
2768 <td style="vertical-align: top;">GL_READ_BUFFER<br>
2769 </td>
2770 <td style="vertical-align: top;">1<br>
2771 </td>
2772 <td style="vertical-align: top;">Current read buffer: GL_FRONT or
2773 GL_BACK.<br>
2774 </td>
2775 </tr>
2776 <tr>
2777 <td style="vertical-align: top;">GL_RED_BITS<br>
2778 </td>
2779 <td style="vertical-align: top;">1<br>
2780 </td>
2781 <td style="vertical-align: top;">Number of bits per red value in
2782 the frame buffer.<br>
2783 </td>
2784 </tr>
2785 <tr>
2786 <td style="vertical-align: top;">GL_RENDER_MODE<br>
2787 </td>
2788 <td style="vertical-align: top;">1<br>
2789 </td>
2790 <td style="vertical-align: top;">Current rendering mode:
2791 GL_RENDER or GL_SELECTION.<br>
2792 </td>
2793 </tr>
2794 <tr>
2795 <td style="vertical-align: top;">GL_RGBA_MODE<br>
2796 </td>
2797 <td style="vertical-align: top;">1<br>
2798 </td>
2799 <td style="vertical-align: top;">Always one.<br>
2800 </td>
2801 </tr>
2802 <tr>
2803 <td style="vertical-align: top;">GL_SCISSOR_BOX<br>
2804 </td>
2805 <td style="vertical-align: top;">4<br>
2806 </td>
2807 <td style="vertical-align: top;">Scissor box (x, y, width,
2808 height).<br>
2809 </td>
2810 </tr>
2811 <tr>
2812 <td style="vertical-align: top;">GL_SCISSOR_TEST<br>
2813 </td>
2814 <td style="vertical-align: top;">1<br>
2815 </td>
2816 <td style="vertical-align: top;">Zero if scissor test is disabled.<br>
2817 One if scissor test is enabled.<br>
2818 </td>
2819 </tr>
2820 <tr>
2821 <td style="vertical-align: top;">GL_SELECTION_BUFFER_SIZE<br>
2822 </td>
2823 <td style="vertical-align: top;">1<br>
2824 </td>
2825 <td style="vertical-align: top;">Size of selection buffer.<br>
2826 </td>
2827 </tr>
2828 <tr>
2829 <td style="vertical-align: top;">GL_SHADE_MODEL<br>
2830 </td>
2831 <td style="vertical-align: top;">1<br>
2832 </td>
2833 <td style="vertical-align: top;">Shade model: GL_FLAT or
2834 GL_SMOOTH.<br>
2835 </td>
2836 </tr>
2837 <tr>
2838 <td style="vertical-align: top;">GL_STENCIL_BITS<br>
2839 </td>
2840 <td style="vertical-align: top;">1<br>
2841 </td>
2842 <td style="vertical-align: top;">Number of bits per stencil value
2843 in the frame buffer.<br>
2844 </td>
2845 </tr>
2846 <tr>
2847 <td style="vertical-align: top;">GL_STENCIL_CLEAR_VALUE<br>
2848 </td>
2849 <td style="vertical-align: top;">1<br>
2850 </td>
2851 <td style="vertical-align: top;">Stencil buffer clear value.<br>
2852 </td>
2853 </tr>
2854 <tr>
2855 <td style="vertical-align: top;">GL_STENCIL_FAIL<br>
2856 </td>
2857 <td style="vertical-align: top;">1<br>
2858 </td>
2859 <td style="vertical-align: top;">Stencil fail operation.<br>
2860 </td>
2861 </tr>
2862 <tr>
2863 <td style="vertical-align: top;">GL_STENCIL_FUNC<br>
2864 </td>
2865 <td style="vertical-align: top;">1<br>
2866 </td>
2867 <td style="vertical-align: top;">Stencil function.<br>
2868 </td>
2869 </tr>
2870 <tr>
2871 <td style="vertical-align: top;">GL_STENCIL_REF<br>
2872 </td>
2873 <td style="vertical-align: top;">1<br>
2874 </td>
2875 <td style="vertical-align: top;">Stencil reference value.<br>
2876 </td>
2877 </tr>
2878 <tr>
2879 <td style="vertical-align: top;">GL_STENCIL_TEST<br>
2880 </td>
2881 <td style="vertical-align: top;">1<br>
2882 </td>
2883 <td style="vertical-align: top;">Zero if stencil test is disabled.<br>
2884 One if stencil test is enabled.<br>
2885 </td>
2886 </tr>
2887 <tr>
2888 <td style="vertical-align: top;">GL_STENCIL_VALUE_MASK<br>
2889 </td>
2890 <td style="vertical-align: top;">1<br>
2891 </td>
2892 <td style="vertical-align: top;">Stencil mask value.<br>
2893 </td>
2894 </tr>
2895 <tr>
2896 <td style="vertical-align: top;">GL_STENCIL_WRITE_MASK<br>
2897 </td>
2898 <td style="vertical-align: top;">1<br>
2899 </td>
2900 <td style="vertical-align: top;">Stencil buffer write mask.<br>
2901 </td>
2902 </tr>
2903 <tr>
2904 <td style="vertical-align: top;">GL_TEXTURE_2D<br>
2905 </td>
2906 <td style="vertical-align: top;">1<br>
2907 </td>
2908 <td style="vertical-align: top;">Zero if 2D texture mapping is
2909 disabled.<br>
2910 One if 2D texture mapping is enabled.<br>
2911 </td>
2912 </tr>
2913 <tr>
2914 <td style="vertical-align: top;">GL_TEXTURE_BINDING_2D</td>
2915 <td style="vertical-align: top;">1<br>
2916 </td>
2917 <td style="vertical-align: top;">Name of currently bound 2D
2918 texture object.<br>
2919 </td>
2920 </tr>
2921 <tr>
2922 <td style="vertical-align: top;">GL_TEXTURE_ENV_COLOR<br>
2923 </td>
2924 <td style="vertical-align: top;">4<br>
2925 </td>
2926 <td style="vertical-align: top;">Texture environment color (red,
2927 green, blue, alpha).<br>
2928 </td>
2929 </tr>
2930 <tr>
2931 <td style="vertical-align: top;">GL_TEXTURE_ENV_MODE<br>
2932 </td>
2933 <td style="vertical-align: top;">1<br>
2934 </td>
2935 <td style="vertical-align: top;">Texture environment mode.<br>
2936 </td>
2937 </tr>
2938 <tr>
2939 <td style="vertical-align: top;">GL_UNPACK_ROW_LENGTH<br>
2940 </td>
2941 <td style="vertical-align: top;">1<br>
2942 </td>
2943 <td style="vertical-align: top;">Pixel unpacking row length.<br>
2944 </td>
2945 </tr>
2946 <tr>
2947 <td style="vertical-align: top;">GL_UNPACK_LSB_FIRST<br>
2948 </td>
2949 <td style="vertical-align: top;">1<br>
2950 </td>
2951 <td style="vertical-align: top;">Zero if most significant bit is
2952 unpacked first for bitmaps.<br>
2953 One if least significant bit is unpacked first for bitmaps.<br>
2954 </td>
2955 </tr>
2956 <tr>
2957 <td style="vertical-align: top;">GL_VIEWPORT<br>
2958 </td>
2959 <td style="vertical-align: top;">4<br>
2960 </td>
2961 <td style="vertical-align: top;">Current viewport (x, y, width,
2962 height).<br>
2963 </td>
2964 </tr>
2965 </tbody>
2966 </table>
2967 <br>
2968 <br>
2969 <h2>9.2 String Queries</h2>
2970 The command<br>
2971 <br>
2972 <div style="margin-left: 40px;">const GLubyte *<span
2973 style="font-weight: bold;">glGetString</span>(GLenum <span
2974 style="font-style: italic;">name</span>)<br>
2975 </div>
2976 <br>
2977 is used to query string-valued values. &nbsp;The legal values for <span
2978 style="font-style: italic;">name</span> are described in the following
2979 table:<br>
2980 <br>
2981 <table cellpadding="2" cellspacing="2" border="1"
2982 style="text-align: left; width: 80%; margin-left: auto; margin-right: auto;">
2983 <tbody>
2984 <tr>
2985 <td style="vertical-align: top;"><span style="font-style: italic;">name</span><br>
2986 </td>
2987 <td style="vertical-align: top;">Return value<br>
2988 </td>
2989 </tr>
2990 <tr>
2991 <td style="vertical-align: top;">GL_VERSION<br>
2992 </td>
2993 <td style="vertical-align: top;">The library version, such as
2994 "1.2".<br>
2995 </td>
2996 </tr>
2997 <tr>
2998 <td style="vertical-align: top;">GL_RENDERER<br>
2999 </td>
3000 <td style="vertical-align: top;">The renderer, such as "Mesa DRI
3001 Radeon".<br>
3002 </td>
3003 </tr>
3004 <tr>
3005 <td style="vertical-align: top;">GL_VENDOR<br>
3006 </td>
3007 <td style="vertical-align: top;">The vendor of this
3008 implementation, such as "Tungsten Graphics, Inc."<br>
3009 </td>
3010 </tr>
3011 <tr>
3012 <td style="vertical-align: top;">GL_EXTENSIONS<br>
3013 </td>
3014 <td style="vertical-align: top;">A white-space separated list of
3015 the supported extensions. </td>
3016 </tr>
3017 </tbody>
3018 </table>
3019 <br>
3020 <h2>9.3 Error Queries</h2>
3021 The command<br>
3022 <br>
3023 <div style="margin-left: 40px;">GLenum <span style="font-weight: bold;">glGetError</span>(void)<br>
3024 </div>
3025 <br>
3026 returns the current error code. &nbsp;The current error code will be
3027 set by a GL command when an error condition has been detected. &nbsp;If
3028 the current error code is already set, subsequent errors will not be
3029 recorded. &nbsp;The error code is reset/cleared to GL_NO_ERROR when <span
3030 style="font-weight: bold;">glGetError</span> returns. &nbsp;The
3031 following error codes are possible:<br>
3032 <br>
3033 <table cellpadding="2" cellspacing="2" border="1"
3034 style="text-align: left; width: 80%; margin-left: auto; margin-right: auto;">
3035 <tbody>
3036 <tr>
3037 <td style="vertical-align: top;">Error code<br>
3038 </td>
3039 <td style="vertical-align: top;">Meaning<br>
3040 </td>
3041 </tr>
3042 <tr>
3043 <td style="vertical-align: top;">GL_NO_ERROR<br>
3044 </td>
3045 <td style="vertical-align: top;">No error has been recorded.<br>
3046 </td>
3047 </tr>
3048 <tr>
3049 <td style="vertical-align: top;">GL_INVALID_ENUM<br>
3050 </td>
3051 <td style="vertical-align: top;">An enum parameter had an invalid
3052 value.<br>
3053 </td>
3054 </tr>
3055 <tr>
3056 <td style="vertical-align: top;">GL_INVALID_VALUE<br>
3057 </td>
3058 <td style="vertical-align: top;">A numeric parameter had an
3059 invalid value.<br>
3060 </td>
3061 </tr>
3062 <tr>
3063 <td style="vertical-align: top;">GL_INVALID_OPERATION<br>
3064 </td>
3065 <td style="vertical-align: top;">A function was called when not
3066 legal to do so.<br>
3067 </td>
3068 </tr>
3069 <tr>
3070 <td style="vertical-align: top;">GL_STACK_OVERFLOW<br>
3071 </td>
3072 <td style="vertical-align: top;">The current transformation
3073 matrix stack is full.<br>
3074 </td>
3075 </tr>
3076 <tr>
3077 <td style="vertical-align: top;">GL_STACK_UNDERFLOW<br>
3078 </td>
3079 <td style="vertical-align: top;">The current transformation
3080 matrix stack is empty.<br>
3081 </td>
3082 </tr>
3083 <tr>
3084 <td style="vertical-align: top;">GL_OUT_OF_MEMORY<br>
3085 </td>
3086 <td style="vertical-align: top;">The system ran out of dynamic
3087 memory.<br>
3088 </td>
3089 </tr>
3090 </tbody>
3091 </table>
3092 <br>
3093 <br>
3094 <h1>10. Unsupported Features</h1>
3095 This section lists other features and functions which are not supported
3096 and not previously discussed.<br>
3097 <br>
3098 <h2>10.1 Feedback Mode</h2>
3099 Feedback mode and the following related functions are not supported.<br>
3100 <br>
3101 <div style="margin-left: 40px;"><span style="font-weight: bold;">glFeedbackBuffer</span><br>
3102 <span style="font-weight: bold;">glPassThrough</span><br>
3103 </div>
3104 <br>
3105 <h2>10.2 1D and 3D Textures<br>
3106 </h2>
3107 Only 2D texture images are supported. &nbsp;The following functions
3108 used to specify 1D and 3D texture images are not supported:<br>
3109 <br>
3110 <div style="margin-left: 40px;"><span style="font-weight: bold;">glTexImage1D</span><br
3111 style="font-weight: bold;">
3112 <span style="font-weight: bold;">glTexImage3D</span><br
3113 style="font-weight: bold;">
3114 <span style="font-weight: bold;">glTexSubImage1D</span><br
3115 style="font-weight: bold;">
3116 <span style="font-weight: bold;"> glTexSubImage3D</span><br
3117 style="font-weight: bold;">
3118 <span style="font-weight: bold;">glCopyTexImage1D</span><br
3119 style="font-weight: bold;">
3120 <span style="font-weight: bold;"> glCopyTexSubImage1D</span><br
3121 style="font-weight: bold;">
3122 <span style="font-weight: bold;"> glCopyTexSubImage3D</span><br>
3123 </div>
3124 <br>
3125 <h2>10.3 Alternate Texture Image Commands<br>
3126 </h2>
3127 Texture images may only be specified with <span
3128 style="font-weight: bold;">glTexImage2D</span>. &nbsp;The following
3129 alternate texture image commands are not supported:<br>
3130 <br>
3131 <div style="margin-left: 40px; font-weight: bold;">glTexSubImage2D<br>
3132 glCopyTexImage2D<br>
3133 glCopyTexSubImage2D<br>
3134 </div>
3135 <br>
3136 <h2>10.4 Proxy Textures</h2>
3137 Proxy textures are not supported and the GL_PROXY_TEXTURE_2D token is
3138 not supported by any function.<br>
3139 <br>
3140 <br>
3141 <h2>10.5 Other Texture Commands</h2>
3142 The following commands related to texture mapping are not supported by
3143 the subset:<br>
3144 <br>
3145 <div style="margin-left: 40px; font-weight: bold;"> glPrioritizeTextures<br>
3146 glAreTexturesResident<br>
3147 glIsTexture<br>
3148 glTexEnviv<br>
3149 glTexEnvf<br>
3150 glTexParameterf<br>
3151 glTexParameteriv<br>
3152 glTexParameterfv<br>
3153 </div>
3154 <br>
3155 <br>
3156 <h2>10.6 Copy and Draw Pixels<br>
3157 </h2>
3158 The following commands are not supported:<br>
3159 <br>
3160 <div style="margin-left: 40px;"><span style="font-weight: bold;">glDrawPixels<br>
3161 glCopyPixels<br>
3162 glPixelZoom<br>
3163 <br>
3164 </span></div>
3165 <h2>10.7 Color Index Mode<br>
3166 </h2>
3167 Color index mode and the following related commands are not supported:<br>
3168 <br>
3169 <span style="font-weight: bold;"></span>
3170 <div style="margin-left: 40px;"><span style="font-weight: bold;">glIndexub<br>
3171 </span><span style="font-weight: bold;">glIndexi</span><br>
3172 <span style="font-weight: bold;">glIndexs<br>
3173 glIndexf<br>
3174 glIndexd<br>
3175 </span><span style="font-weight: bold;">glIndexubv<br>
3176 </span><span style="font-weight: bold;">glIndexiv</span><br>
3177 <span style="font-weight: bold;">glIndexsv<br>
3178 glIndexfv<br>
3179 glIndexdv</span><span style="font-weight: bold;"><br>
3180 glIndexMask<br>
3181 </span><span style="font-weight: bold;">glClearIndex<br>
3182 glIndexPointer</span><br style="font-weight: bold;">
3183 <br>
3184 </div>
3185 <h2>10.8 Pixel Transfer Operations</h2>
3186 The pixel transfer operations (scale, bias, look-up table, etc) are not
3187 supported and the following commands are omitted:<br>
3188 <br style="font-weight: bold;">
3189 <div style="margin-left: 40px;"><span style="font-weight: bold;">glPixelTransferf</span><br
3190 style="font-weight: bold;">
3191 <span style="font-weight: bold;">glPixelTransferi</span><br
3192 style="font-weight: bold;">
3193 <span style="font-weight: bold;">glPixelMapfv</span><br
3194 style="font-weight: bold;">
3195 <span style="font-weight: bold;">glPixelMapuiv</span><br
3196 style="font-weight: bold;">
3197 <span style="font-weight: bold;">glPixelMapusv</span><br
3198 style="font-weight: bold;">
3199 <span style="font-weight: bold;">glGetPixelMapfv</span><br
3200 style="font-weight: bold;">
3201 <span style="font-weight: bold;">glGetPixelMapuiv</span><br
3202 style="font-weight: bold;">
3203 <span style="font-weight: bold;">glGetPixelMapusv</span><br>
3204 </div>
3205 <br>
3206 <h2>10.9 Hints</h2>
3207 Hints and the following related command is not supported:<br>
3208 <br>
3209 <div style="margin-left: 40px;"><span style="font-weight: bold;">glHint<br>
3210 </span><br>
3211 </div>
3212 <h2>10.10 State Query Commands<br>
3213 </h2>
3214 The following state query commands are not supported:<br>
3215 <br>
3216 <div style="margin-left: 40px; font-weight: bold;">glGetBooleanv<br>
3217 glGetIntegerv<br>
3218 glGetDoublev<br>
3219 glGetPointerv<br>
3220 glGetTexEnvi<br>
3221 glGetTexEnvf<br>
3222 glGetTexParameteriv<br>
3223 glGetTexParameterfv<br>
3224 glGetTexLevelParameteriv<br>
3225 glGetTexLevelParameterfv<br>
3226 glGetTexImage<br>
3227 glGetClipPlane<br>
3228 </div>
3229 <br>
3230 <h2>10.11 Attribute Stacks</h2>
3231 State attribute stacks and the following related commands are not
3232 supported:<br>
3233 <br>
3234 <div style="margin-left: 40px;"><span style="font-weight: bold;">glPushAttrib</span><br
3235 style="font-weight: bold;">
3236 <span style="font-weight: bold;">glPopAtttrib</span><br>
3237 <br style="font-weight: bold;">
3238 </div>
3239 <h2>10.12 Double-Valued Functions</h2>
3240 All functions which take double-precision floating point values, but
3241 for which there is an equivalent single-precision valued function, are
3242 omitted. &nbsp;This includes, but is not limited to:<br>
3243 <br>
3244 <div style="margin-left: 40px;"><span style="font-weight: bold;">glVertex2d</span><br
3245 style="font-weight: bold;">
3246 <span style="font-weight: bold;">glVertex2dv</span><br
3247 style="font-weight: bold;">
3248 <span style="font-weight: bold;">glVertex3d</span><br
3249 style="font-weight: bold;">
3250 <span style="font-weight: bold;"> glVertex3dv</span><br
3251 style="font-weight: bold;">
3252 <span style="font-weight: bold;">glVertex4d</span><br
3253 style="font-weight: bold;">
3254 <span style="font-weight: bold;"> glVertex4dv</span><br
3255 style="font-weight: bold;">
3256 <span style="font-weight: bold;">glColor3d</span><br
3257 style="font-weight: bold;">
3258 <span style="font-weight: bold;">glColor3d</span><span
3259 style="font-weight: bold;">v</span><br style="font-weight: bold;">
3260 <span style="font-weight: bold;">glColor4d</span><br
3261 style="font-weight: bold;">
3262 <span style="font-weight: bold;"> glColor4dv</span><br
3263 style="font-weight: bold;">
3264 <span style="font-weight: bold;">glTexCoord1d</span><br
3265 style="font-weight: bold;">
3266 <span style="font-weight: bold;">glTexCoord1d</span><span
3267 style="font-weight: bold;">v</span><br style="font-weight: bold;">
3268 <span style="font-weight: bold;">glTexCoord2d</span><br
3269 style="font-weight: bold;">
3270 <span style="font-weight: bold;"> glTexCoord2dv</span><br
3271 style="font-weight: bold;">
3272 <span style="font-weight: bold;">glTexCoord3d</span><br
3273 style="font-weight: bold;">
3274 <span style="font-weight: bold;"> glTexCoord3dv</span><br
3275 style="font-weight: bold;">
3276 <span style="font-weight: bold;">glTexCoord4d</span><br
3277 style="font-weight: bold;">
3278 <span style="font-weight: bold;"> glTexCoord4dv</span><br
3279 style="font-weight: bold;">
3280 <span style="font-weight: bold;">glRasterPos2d</span><br
3281 style="font-weight: bold;">
3282 <span style="font-weight: bold;"> glRasterPos2dv</span><br
3283 style="font-weight: bold;">
3284 <span style="font-weight: bold;">glRasterPos3d</span><br
3285 style="font-weight: bold;">
3286 <span style="font-weight: bold;"> glRasterPos3dv</span><br
3287 style="font-weight: bold;">
3288 <span style="font-weight: bold;">glRasterPos4d</span><br
3289 style="font-weight: bold;">
3290 <span style="font-weight: bold;"> glRasterPos4dv</span><br
3291 style="font-weight: bold;">
3292 <span style="font-weight: bold;">glLoadMatrixd</span><br
3293 style="font-weight: bold;">
3294 <span style="font-weight: bold;">glMultMatrixd</span><br
3295 style="font-weight: bold;">
3296 <span style="font-weight: bold;">glScaled</span><br
3297 style="font-weight: bold;">
3298 <span style="font-weight: bold;">glRotated</span><br
3299 style="font-weight: bold;">
3300 <span style="font-weight: bold;">glTranslated<br>
3301 glRectd<br>
3302 glRectdv<br>
3303 </span> <span style="font-weight: bold;"><br>
3304 </span> </div>
3305 <h2>10.13 Evaluators</h2>
3306 Evaluators and the following related commands are not supported:<br>
3307 <br>
3308 <div style="margin-left: 40px;"><span style="font-weight: bold;">glMap1f</span><br
3309 style="font-weight: bold;">
3310 <span style="font-weight: bold;">glMap2d</span><br
3311 style="font-weight: bold;">
3312 <span style="font-weight: bold;">glMap2f</span><br
3313 style="font-weight: bold;">
3314 <span style="font-weight: bold;">glGetMapdv</span><br
3315 style="font-weight: bold;">
3316 <span style="font-weight: bold;">glGetMapfv</span><br
3317 style="font-weight: bold;">
3318 <span style="font-weight: bold;">glGetMapiv</span><br
3319 style="font-weight: bold;">
3320 <span style="font-weight: bold;">glEvalCoord1d</span><br
3321 style="font-weight: bold;">
3322 <span style="font-weight: bold;">glEvalCoord1f</span><br
3323 style="font-weight: bold;">
3324 <span style="font-weight: bold;">glEvalCoord1dv</span><br
3325 style="font-weight: bold;">
3326 <span style="font-weight: bold;">glEvalCoord1fv</span><br
3327 style="font-weight: bold;">
3328 <span style="font-weight: bold;">glEvalCoord2d</span><br
3329 style="font-weight: bold;">
3330 <span style="font-weight: bold;">glEvalCoord2f</span><br
3331 style="font-weight: bold;">
3332 <span style="font-weight: bold;">glEvalCoord2dv</span><br
3333 style="font-weight: bold;">
3334 <span style="font-weight: bold;">glEvalCoord2fv</span><br
3335 style="font-weight: bold;">
3336 <span style="font-weight: bold;">glMapGrid1d</span><br
3337 style="font-weight: bold;">
3338 <span style="font-weight: bold;">glMapGrid1f</span><br
3339 style="font-weight: bold;">
3340 <span style="font-weight: bold;">glMapGrid2d</span><br
3341 style="font-weight: bold;">
3342 <span style="font-weight: bold;">glMapGrid2f</span><br
3343 style="font-weight: bold;">
3344 <span style="font-weight: bold;">glEvalPoint1</span><br
3345 style="font-weight: bold;">
3346 <span style="font-weight: bold;">glEvalPoint2</span><br
3347 style="font-weight: bold;">
3348 <span style="font-weight: bold;">glEvalMesh1</span><br
3349 style="font-weight: bold;">
3350 <span style="font-weight: bold;">glEvalMesh2</span><br
3351 style="font-weight: bold;">
3352 </div>
3353 <br>
3354 <h2>10.14 Display Lists</h2>
3355 Display lists and the following related commands are not supported:<br>
3356 <br>
3357 <div style="margin-left: 40px; font-weight: bold;">glIsList<br>
3358 glDeleteLists<br>
3359 glGenLists<br>
3360 glNewList<br>
3361 glEndList<br>
3362 glCallList<br>
3363 glCallLists<br>
3364 glListBase<br>
3365 </div>
3366 <br>
3367 <h2>10.15 Accumulation Buffer</h2>
3368 The accumulation buffer and the following related commands are not
3369 supported:<br>
3370 <br style="font-weight: bold;">
3371 <div style="margin-left: 40px;"><span style="font-weight: bold;">glAccum</span><br
3372 style="font-weight: bold;">
3373 <span style="font-weight: bold;">glClearAccum</span><br>
3374 </div>
3375 <br>
3376 <h2>10.16 Fog</h2>
3377 Fog and the following related commands are not supported:<br>
3378 <br>
3379 <div style="margin-left: 40px; font-weight: bold;"> glFogi<br>
3380 glFogf<br>
3381 glFogiv<br>
3382 glFogfv<br>
3383 </div>
3384 <br>
3385 <h2>10.17 Depth Test</h2>
3386 Depth testing and the following related commands are not supported:<br>
3387 <br>
3388 <div style="margin-left: 40px;"><span style="font-weight: bold;">glDepthFunc</span><br
3389 style="font-weight: bold;">
3390 <span style="font-weight: bold;">glDepthMask</span><br
3391 style="font-weight: bold;">
3392 <span style="font-weight: bold;">glDepthRange</span><br
3393 style="font-weight: bold;">
3394 <span style="font-weight: bold;">glClearDepth</span><br>
3395 </div>
3396 <br>
3397 <h2>10.18 Imaging Subset</h2>
3398 The OpenGL imaging subset (which implements features such as
3399 convolution, histogram, min/max recording, color matrix and color
3400 tables) is not supported.<br>
3401 <br>
3402 <br>
3403 <h1>Appendix A: Issues</h1>
3404 This appendix lists documentation and subset issues with their current
3405 status. &nbsp;For items which are still open, the documentation (above)
3406 follows the recommended solution.<br>
3407 <br>
3408 <h2>A.1 Vertex Arrays</h2>
3409 Should vertex arrays be supported? &nbsp;Is there a performance
3410 advantage?<br>
3411 <br>
3412 RESOLUTION: No, there isn't enough of a performance advantage to
3413 justify them.<br>
3414 <br>
3415 <h2>A.2 Polygon Antialiasing and Edge Flags</h2>
3416 Should edge flags be supported for antialiasing?<br>
3417 <br>
3418 Edge flags don't effect antialiasing, at least not normally. &nbsp;A
3419 number of approaches to antialiasing have been summarized in email.<br>
3420 <br>
3421 RECOMMENDATION: don't support edge flags. &nbsp;They don't effect
3422 polygon antialiasing.<br>
3423 <br>
3424 RESOLUTION: closed, as of 26 Feb 2003.<br>
3425 <br>
3426 <h2>A.3 glRasterPos vs. glWindowPos</h2>
3427 Should glRasterPos and/or glWindowPos commands be supported?<br>
3428 <br>
3429 RESOLUTION: Closed: implement glRasterPos commands, but not glWindowPos
3430 commands.<br>
3431 <br>
3432 <h2>A.4 GL_IBM_rasterpos_clip extension</h2>
3433 Should the GL_IBM_rasterpos_clip extension be implemented?<br>
3434 <br>
3435 RESOLUTION: &nbsp;No. &nbsp;It's not required.<br>
3436 <br>
3437 <h2>A.5 Image Formats and Types</h2>
3438 Which image formats and types should be supported for <span
3439 style="font-weight: bold;">glTexImage2D</span> and <span
3440 style="font-weight: bold;">glReadPixels</span>?<br>
3441 <br>
3442 OpenGL specifies a <span style="font-weight: bold;">large</span>
3443 variety of image formats and data types. &nbsp;Only a few are commonly
3444 used.<br>
3445 <br>
3446 RECOMMENDATION: &nbsp;we propose a subset:<br>
3447 <br>
3448 For <span style="font-weight: bold;">glTexImage2D</span> only allow <span
3449 style="font-style: italic;">type</span>=GL_UNSIGNED_BYTE and <span
3450 style="font-style: italic;">format</span>=GL_RGBA, GL_RGB,
3451 GL_INTENSITY. &nbsp; Only allow <span style="font-style: italic;">internalFormat</span>
3452 to be GL_RGBA, GL_RGB or GL_INTENSITY as well.&nbsp; Basically, only
3453 support image formats/types that are directly supported by the Radeon
3454 hardware. &nbsp;This will allow <span style="font-weight: bold;">glTexImage2D</span>
3455 to basically just use <span style="font-weight: bold;">memcpy</span> to
3456 copy texture images.<br>
3457 <br>
3458 For <span style="font-weight: bold;">glReadPixels</span>, only allow <span
3459 style="font-style: italic;">type</span> = GL_UNSIGNED_BYTE or GL_FLOAT.
3460 &nbsp;Only allow <span style="font-style: italic;">format</span> =
3461 GL_RGB or GL_RGBA. &nbsp;This is just enough to support the OpenGL
3462 conformance tests.<br>
3463 <br>
3464 RESOLUTION: open<br>
3465 <br>
3466 <h2>A.6 Texture Environment Modes</h2>
3467 Which texture environment modes should be supported? &nbsp;OpenGL 1.2
3468 has GL_REPLACE, GL_MODULATE, GL_DECAL and GL_BLEND. &nbsp;GL_DECAL isn't
3469 defined for all base internal texture formats. &nbsp;GL_ADD is another
3470 useful mode. &nbsp;Perhaps drop GL_DECAL mode and add GL_ADD mode.<br>
3471 <br>
3472 RECOMMENDATION: implement the standard modes GL_REPLACE, GL_MODULATE,
3473 GL_DECAL and GL_BLEND.<br>
3474 <br>
3475 RESOLUTION: open<br>
3476 <br>
3477 <h2>A.7 Truncated Mipmaps and LOD Control</h2>
3478 Should we support the GL_TEXTURE_BASE_LEVEL, GL_TEXTURE_MAX_LEVEL,
3479 GL_TEXTURE_MIN_LOD and GL_TEXTURE_MAX_LOD texture parameters?<br>
3480 <br>
3481 RECOMMENDATION: &nbsp;We propose omitting these features at this time,
3482 in the interest of simplifying the driver.<br>
3483 <br>
3484 RESOLUTION: open<br>
3485 <br>
3486 <h2>A.8 Texture Priorities and Residency</h2>
3487 Should the subset support texture priorities via <span
3488 style="font-weight: bold;">glPrioritizeTextures</span> and the <span
3489 style="font-weight: bold;">glAreTexturesResident</span> command?<br>
3490 <br>
3491 RECOMMENDATION: &nbsp;Few applications use these features and
3492 functions. &nbsp;We propose omitting them to simplify the driver.<br>
3493 <br>
3494 RESOLUTION: open<br>
3495 <br>
3496 <h2>A.9 Pixel Pack/Unpack Alignment Control</h2>
3497 Should we support the GL_PACK_ALIGNMENT and GL_UNPACK_ALIGNMENT options?<br>
3498 <br>
3499 These are used to align pixel data addresses to 1, 2 and 4-byte
3500 multiples for <span style="font-weight: bold;">glBitmap, glTexImage2D</span>
3501 and <span style="font-weight: bold;">glReadPixels</span>. &nbsp;These
3502 aren't strictly needed since the user can provide a 1, 2 or 4-byte
3503 aligned address and appropriate GL_PACK_ROW_LENGTH or
3504 GL_UNPACK_ROW_LENGTH values instead.<br>
3505 <br>
3506 RECOMMENDATION: &nbsp;We recommend omitting them to simplify the driver.<br>
3507 <br>
3508 RESOLUTION: open<br>
3509 <br>
3510 <h2>A.10 Pixel Pack/Unpack Skip Rows/Pixels Control</h2>
3511 Should we support the GL_UNPACK_SKIP_PIXELS, GL_UNPACK_SKIP_ROWS,
3512 GL_PACK_SKIP_PIXELS and GL_PACK_SKIP_ROWS options for pixel
3513 unpacking/packing?<br>
3514 <br>
3515 These options aren't really needed since the user can adjust the start
3516 address and GL_PACK/UNPACK_ROW_LENGTH parameters to achieve the same
3517 effect.<br>
3518 <br>
3519 RECOMMENDATION: &nbsp;omit these parameters.<br>
3520 <br>
3521 RESOLUTION: open<br>
3522 <br>
3523 <h2>A.11 Texture State Queries</h2>
3524 Should we support the command <span style="font-weight: bold;">glGetTexEnvi/fv,
3525 glGetTexParameteri/fv</span> and <span style="font-weight: bold;">glGetTexLevelParameteri/fv</span>?<br>
3526 <br>
3527 RECOMMENDATION: &nbsp;No.&nbsp;They're seldom needed and their
3528 implementation is several hundred lines of code in length.<br>
3529 <br>
3530 RESOLUTION: &nbsp;open<br>
3531 <br>
3532 <h2>A.12 glGetIntegerv, glGetBooleanv and glGetDoublev</h2>
3533 Should we support the commands <span style="font-weight: bold;">glGetIntegerv,
3534 glGetBooleanv </span>and <span style="font-weight: bold;">glGetDoublev</span>
3535 in addition to <span style="font-weight: bold;">glGetFloatv</span>?<br>
3536 <br>
3537 RECOMMENDATION: &nbsp;Omit the boolean, integer and double-valued
3538 functions. All state values which can be queried by these commands can
3539 be expressed as floating point values and queried with <span
3540 style="font-weight: bold;">glGetFloatv</span>. &nbsp;The
3541 implementation of the other three commands involves many lines of code.<br>
3542 <br>
3543 RESOLUTION: &nbsp;open<br>
3544 <br>
3545 <h2>A.13 glBitmap and Per-Fragment Operations</h2>
3546 Should bitmaps rendered with <span style="font-weight: bold;">glBitmap</span>
3547 be subjected to the per-fragment operations?<br>
3548 <br>
3549 If bitmaps are implemented with points it will be easy to implement the
3550 per-fragment operations. &nbsp;Otherwise, it could be difficult.<br>
3551 <br>
3552 RECOMMENDATION: &nbsp;Implement glBitmap by drawing points/pixels with
3553 the hardware. &nbsp;This will make supporting the per-fragments
3554 trivially easy. &nbsp;Also, it makes portrait-mode display relatively
3555 easy.<br>
3556 <br>
3557 RESOLUTION: &nbsp;open<br>
3558 <br>
3559 <h2>A.14 Reduced gl.h Header File</h2>
3560 Should we produce a reduced gl.h header file which only defines the
3561 tokens and functions which are implemented by the subset?<br>
3562 <br>
3563 RECOMMENDATION: yes. &nbsp;It would be a useful reference to
3564 programmers to quickly determine which functions and tokens are
3565 supported.<br>
3566 <br>
3567 RESOLUTION: open<br>
3568 <br>
3569 <h2>A.15 glPolygonMode</h2>
3570 Is <span style="font-weight: bold;">glPolygonMode</span> needed?<br>
3571 <br>
3572 RECOMMENDATION: No. &nbsp;Omit it.<br>
3573 <br>
3574 RESOLUTION: closed, as of 26 Feb 2003<br>
3575 <br>
3576 <br>
3577 <p> </p>
3578 </body>
3579 </html>