- Page 1 and 2: OpenGL Programming Guide Second Edi
- Page 3 and 4: Examples of Composing Several Trans
- Page 5 and 6: Bitmaps and Fonts The Current Raste
- Page 7 and 8: Chapter 12 Evaluators and NURBS Pre
- Page 9 and 10: Implementation−Dependent Pixel De
- Page 11 and 12: Rotation Perspective Projection Ort
- Page 13 and 14: depth−cuing diffuse directional l
- Page 15 and 16: RGBA mode server shading shininess
- Page 17 and 18: To Tom Doeppner and Andy van Dam, w
- Page 19 and 20: textures onto three−dimensional o
- Page 21 and 22: geometry). Even if you have little
- Page 23 and 24: Acknowledgments The second edition
- Page 25 and 26: Chapter 1 Introduction to OpenGL Ch
- Page 27 and 28: of motion. "Plate 8" shows the scen
- Page 29 and 30: } glVertex3f (0.25, 0.75, 0.0); glE
- Page 31 and 32: OpenGL as a State Machine OpenGL is
- Page 33 and 34: is enabled and the primitive is a p
- Page 35 and 36: If you are directly accessing a win
- Page 37 and 38: glVertex3f (0.75, 0.75, 0.0); glVer
- Page 39 and 40: human eye is only so good. The key
- Page 41 and 42: Figure 1−3 Double−Buffered Rota
- Page 43 and 44: Chapter 2 State Management and Draw
- Page 45 and 46: appropriate size and location for a
- Page 47: Chapter 5 for details on these topi
- Page 51 and 52: See Figure 2−3 for some examples
- Page 53 and 54: glVertex4f(2.3, 1.0, −2.2, 2.0);
- Page 55 and 56: GL_LINES Draws a series of unconnec
- Page 57 and 58: ones in blue, despite the extra col
- Page 59 and 60: void glLineWidth(GLfloat width); Se
- Page 61 and 62: void display(void) { int i; glClear
- Page 63 and 64: GL_FILL to indicate whether the pol
- Page 65 and 66: Figure 2−10 Constructing a Polygo
- Page 67 and 68: 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55,
- Page 69 and 70: glPolygonMode(GL_FRONT_AND_BACK, GL
- Page 71 and 72: Figure 2−14 Six Sides; Eight Shar
- Page 73 and 74: void glEdgeFlagPointer(GLsizei stri
- Page 75 and 76: glEnableClientState (GL_VERTEX_ARRA
- Page 77 and 78: process as few as eight vertices. (
- Page 79 and 80: } else glColorPointer(sc, tc, str,
- Page 81 and 82: GL_ALL_ATTRIB_BITS −− GL_COLOR_
- Page 83 and 84: glBegin(GL_LINE_STRIP); for (i = 0;
- Page 85 and 86: } out[0] = v1[1]*v2[2] − v1[2]*v2
- Page 87 and 88: } } for (i = 0; i < 3; i++) { } v12
- Page 89 and 90: Chapter 3 Viewing Chapter Objective
- Page 91 and 92: the following. 1. Set up your tripo
- Page 93 and 94: program, not necessarily the order
- Page 95 and 96: } glViewport (0, 0, (GLsizei) w, (G
- Page 97 and 98: interior spaces look when viewed fr
- Page 99 and 100:
Philosophy" in Chapter 7.) (OpenGL
- Page 101 and 102:
x−axis), if you want the object t
- Page 103 and 104:
shown in Figure 3−6. Figure 3−6
- Page 105 and 106:
glLoadIdentity(); glScalef(1.5, 0.5
- Page 107 and 108:
Figure 3−10 Separating the Viewpo
- Page 109 and 110:
Figure 3−12 Using gluLookAt() So,
- Page 111 and 112:
glMatrixMode(GL_PROJECTION); glLoad
- Page 113 and 114:
GLdouble near, GLdouble far); Creat
- Page 115 and 116:
planes and locate them wherever you
- Page 117 and 118:
(Chapter 10 discusses the depth buf
- Page 119 and 120:
{ } double radtheta, degtheta; radt
- Page 121 and 122:
Figure 3−21 Pushing and Popping t
- Page 123 and 124:
Advanced If you know enough mathema
- Page 125 and 126:
* clip left half −− x < 0 */ }
- Page 127 and 128:
#include #include #include stati
- Page 129 and 130:
Figure 3−25 Robot Arm You can use
- Page 131 and 132:
} } case ‘S’: shoulder = (shoul
- Page 133 and 134:
#include #include #include #incl
- Page 135 and 136:
Chapter 4 Color Chapter Objectives
- Page 137 and 138:
is called the color buffer. The siz
- Page 139 and 140:
number of bitplanes, 0.0 specifies
- Page 141 and 142:
Figure 4−4 A Color Map A painter
- Page 143 and 144:
mode. Then you must control the vis
- Page 145 and 146:
GL_FLAT. With flat shading, the col
- Page 147 and 148:
independent quad 4i Table 4−2 How
- Page 149 and 150:
"Real−World and OpenGL Lighting"
- Page 151 and 152:
desire a more accurate (or just dif
- Page 153 and 154:
Example 5−1 accomplishes these ta
- Page 155 and 156:
Example 5−1, the only element of
- Page 157 and 158:
GLfloat light_ambient[] = { 0.0, 0.
- Page 159 and 160:
Figure 5−2 GL_SPOT_CUTOFF Paramet
- Page 161 and 162:
A light position that remains fixed
- Page 163 and 164:
*/ void display(void) { } GLfloat p
- Page 165 and 166:
} gluLookAt (ex, ey, ez, 0.0, 0.0,
- Page 167 and 168:
it doesn’t matter what the back
- Page 169 and 170:
glMaterialfv(GL_FRONT_AND_BACK, GL_
- Page 171 and 172:
glTranslatef (1.25, 3.0, 0.0); glMa
- Page 173 and 174:
void display(void) { } glClear(GL_C
- Page 175 and 176:
colors when in RGBA mode. (See "The
- Page 177 and 178:
The diffuse term needs to take into
- Page 179 and 180:
of using this color ramp with a sin
- Page 181 and 182:
drawn in a window on the screen? Wh
- Page 183 and 184:
To blend three different images equ
- Page 185 and 186:
#include static int leftFirst = GL
- Page 187 and 188:
already in the framebuffer (the des
- Page 189 and 190:
} glPushMatrix (); glTranslatef (0.
- Page 191 and 192:
Figure 6−2 Aliased and Antialiase
- Page 193 and 194:
#include static float rotAngle = 0
- Page 195 and 196:
} glutDisplayFunc (display); glutMa
- Page 197 and 198:
} } rotAngle += 20.; if (rotAngle >
- Page 199 and 200:
#include #include #include #incl
- Page 201 and 202:
{ } switch (key) { } case ‘t’:
- Page 203 and 204:
} } glFogf (GL_FOG_DENSITY, 0.35);
- Page 205 and 206:
In these three equations, z is the
- Page 207 and 208:
} glFogf (GL_FOG_START, 1.0); glFog
- Page 209 and 210:
where m is the maximum depth slope
- Page 211 and 212:
Chapter 7 Display Lists Chapter Obj
- Page 213 and 214:
} } } } glEnd(); glVertex3f(x, y, z
- Page 215 and 216:
glEnd() calls are stored in the dis
- Page 217 and 218:
implementation may be able to perfo
- Page 219 and 220:
} return 0; The glTranslatef() rout
- Page 221 and 222:
arrays, so these operations can be
- Page 223 and 224:
mechanism requires that you put the
- Page 225 and 226:
} CP; int type; CP Adata[] = { }; {
- Page 227 and 228:
} glTranslatef(10.0, 30.0, 0.0); pr
- Page 229 and 230:
glEndList(); If you use the display
- Page 231 and 232:
Chapter 8 Drawing Pixels, Bitmaps,
- Page 233 and 234:
0xff, 0x00, 0xff, 0x00, 0xc0, 0x00,
- Page 235 and 236:
Drawing the Bitmap Once you’ve se
- Page 237 and 238:
an offset to every entry in the str
- Page 239 and 240:
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3
- Page 241 and 242:
} glutMainLoop(); return 0; Images
- Page 243 and 244:
component, followed by a blue color
- Page 245 and 246:
current drawing buffers with glDraw
- Page 247 and 248:
Figure 8−8 glCopyTexImage*() and
- Page 249 and 250:
Figure 8−9 *SKIP_ROWS, *SKIP_PIXE
- Page 251 and 252:
Pixel Mapping All the color compone
- Page 253 and 254:
} int i, j, c; for (i = 0; i < chec
- Page 255 and 256:
} glutMotionFunc(motion); glutMainL
- Page 257 and 258:
3. Each component (R, G, B, A, or d
- Page 259 and 260:
5. If the storage format is one of
- Page 261 and 262:
lend a texture color with the surfa
- Page 263 and 264:
An Overview and an Example This sec
- Page 265 and 266:
#define checkImageHeight 64 static
- Page 267 and 268:
} init(); glutDisplayFunc(display);
- Page 269 and 270:
texture of internal format GL_R3_G3
- Page 271 and 272:
Note: There is one major limitation
- Page 273 and 274:
{ } switch (key) { } case ‘s’:
- Page 275 and 276:
GL_READ_BUFFER and are processed ex
- Page 277 and 278:
#include #include #include GLuby
- Page 279 and 280:
} glTexEnvf(GL_TEXTURE_ENV, GL_TEXT
- Page 281 and 282:
Figure 9−5 Texture Magnification
- Page 283 and 284:
eturned in textureNames do not have
- Page 285 and 286:
} GL_NEAREST); glTexParameteri(GL_T
- Page 287 and 288:
texture objects. void glPrioritizeT
- Page 289 and 290:
lended with the texture color in a
- Page 291 and 292:
the surface, the more distortion of
- Page 293 and 294:
Figure 9−8 Clamping a Texture You
- Page 295 and 296:
Initially in Example 9−6, equally
- Page 297 and 298:
} glFlush(); void reshape(int w, in
- Page 299 and 300:
calculated only at the time they’
- Page 301 and 302:
indexed by s’/q’ and t’/q’
- Page 303 and 304:
Figure 10−1 Region Occupied by a
- Page 305 and 306:
you might use them for saving an im
- Page 307 and 308:
can be one of the following: GL_FRO
- Page 309 and 310:
7. Logical operation Each of these
- Page 311 and 312:
You can obtain the values for all s
- Page 313 and 314:
} glPushMatrix(); glRotatef (90.0,
- Page 315 and 316:
pixel appears, it’s drawn only if
- Page 317 and 318:
Table 10−4 Sixteen Logical Operat
- Page 319 and 320:
} xwsize = right − left; ywsize =
- Page 321 and 322:
} glutSolidSphere (1.0, 16, 16); gl
- Page 323 and 324:
} glFlush(); void reshape(int w, in
- Page 325 and 326:
Example 10−5 Depth−of−Field E
- Page 327 and 328:
} } glAccum (GL_RETURN, 1.0); glFlu
- Page 329 and 330:
Chapter 11 Tessellators and Quadric
- Page 331 and 332:
hurts to be tidy. Tessellation Call
- Page 333 and 334:
void errorCallback(GLenum errorCode
- Page 335 and 336:
GLdouble value); For the tessellati
- Page 337 and 338:
The winding rules are also designed
- Page 339 and 340:
for several vertices may not get th
- Page 341 and 342:
The GLU provides a routine for obta
- Page 343 and 344:
GLUquadricObj* gluNewQuadric (void)
- Page 345 and 346:
sweepAngle are measured in degrees,
- Page 347 and 348:
} glTranslatef(0.0, 2.0, 0.0); glPu
- Page 349 and 350:
Chapter 12 Evaluators and NURBS Cha
- Page 351 and 352:
vertices can be used like any other
- Page 353 and 354:
} A cubic Bézier curve is describe
- Page 355 and 356:
You can use glEvalCoord1() with any
- Page 357 and 358:
}; {0.5, −1.5, −1.0}, {1.5, −
- Page 359 and 360:
Figure 12−3 Lit, Shaded Bézier S
- Page 361 and 362:
} for (i = 0; i < imageWidth; i++)
- Page 363 and 364:
once with the control points (ratio
- Page 365 and 366:
} glRotatef(330.0, 1.,0.,0.); glSca
- Page 367 and 368:
The default value for GLU_DISPLAY_M
- Page 369 and 370:
points, respectively. You might als
- Page 371 and 372:
Figure 12−6 Trimmed NURBS Surface
- Page 373 and 374:
Chapter 13 Selection and Feedback C
- Page 375 and 376:
As mentioned in the previous sectio
- Page 377 and 378:
void drawTriangle (GLfloat x1, GLfl
- Page 379 and 380:
} glPushMatrix (); glMatrixMode (GL
- Page 381 and 382:
different components of a primitive
- Page 383 and 384:
glMatrixMode (GL_PROJECTION); glPus
- Page 385 and 386:
} glPopMatrix(); /* draw last two w
- Page 387 and 388:
} if (mode == GL_SELECT) glLoadName
- Page 389 and 390:
} return 0; Try This Modify Example
- Page 391 and 392:
hand, selection in three dimensions
- Page 393 and 394:
A Feedback Example Example 13−7 d
- Page 395 and 396:
} glMatrixMode (GL_PROJECTION); glL
- Page 397 and 398:
Chapter 14 Now That You Know Chapte
- Page 399 and 400:
GL_STACK_OVERFLOW Command would cau
- Page 401 and 402:
extension that is available only on
- Page 403 and 404:
Each time through the loop, you cle
- Page 405 and 406:
} } set_color(i,j); glVertex2i(x(i,
- Page 407 and 408:
the bits of the appropriate color d
- Page 409 and 410:
C, ..., I, where region I is outsid
- Page 411 and 412:
Shadows Every possible projection o
- Page 413 and 414:
you’ll need to clear the stencil
- Page 415 and 416:
Figure 14−3 Dirichlet Domains If
- Page 417 and 418:
Video⎯Even if your machine doesn
- Page 419 and 420:
from specialized vertex arrays. Per
- Page 421 and 422:
applied to the top matrix on the st
- Page 423 and 424:
OpenGL State Variables The followin
- Page 425 and 426:
GL_FOG_START Linear fog start fog 0
- Page 427 and 428:
GL_TEXTURE_WRAP_x Texture wrap mode
- Page 429 and 430:
GL_DOMAIN 1D domain endpoints ⎯
- Page 431 and 432:
Appendix C OpenGL and Window System
- Page 433 and 434:
glFinish(), glXWaitGL() doesn’t r
- Page 435 and 436:
Use aglQueryVersion() to determine
- Page 437 and 438:
AGLDrawable aglGetCurrentDrawable (
- Page 439 and 440:
A shortcut for using OS/2 logical f
- Page 441 and 442:
directly. CreateDIBitmap() creates
- Page 443 and 444:
Appendix D Basics of GLUT: The Open
- Page 445 and 446:
depending upon whether the mouse ha
- Page 447 and 448:
Appendix E Calculating Normal Vecto
- Page 449 and 450:
evaluated at a particular point (x,
- Page 451 and 452:
Sometimes, you need to vary this me
- Page 453 and 454:
transformations.) After transformat
- Page 455 and 456:
As before, the inverses are obtaine
- Page 457 and 458:
Appendix G Programming Tips This ap
- Page 459 and 460:
computations. If your application r
- Page 461 and 462:
Appendix H OpenGL Invariance OpenGL
- Page 463 and 464:
Appendix I Color Plates This append
- Page 465 and 466:
Plate 4 The scene drawn with flat
- Page 467 and 468:
Plate 7 The scene drawn with one of
- Page 469 and 470:
. Plate 10 Teapots drawn with jitte
- Page 471 and 472:
Plate 14 Gray teapots drawn with di
- Page 473 and 474:
. Plate 18 Lighted, green teapots d
- Page 475 and 476:
Plate 21 An environment−mapped ob
- Page 477 and 478:
Plate 23 A magnification of the pre
- Page 479 and 480:
Plate 27 Sophisticated use of textu
- Page 481 and 482:
Plate 31 Another scene from a diffe
- Page 483 and 484:
itplane A rectangular array of bits
- Page 485 and 486:
decal A method of calculating color
- Page 487 and 488:
gamma correction A function applied
- Page 489 and 490:
A source of illumination which has
- Page 491 and 492:
A point, a line, a polygon, a bitma
- Page 493 and 494:
The 4×4 matrix that transforms tex
- Page 495:
Index