About This Guide |
|
xix | |
What This Guide Contains |
|
xix | |
What's New in This Edition |
|
xxii | |
What You Should Know Before Reading This Guide |
|
xxiii | |
How to Obtain the Sample Code |
|
xxiv | |
Nate Robins' OpenGL Tutors |
|
xxv | |
Errata |
|
xxv | |
Style Conventions |
|
xxv | |
Acknowledgments |
|
xxvii | |
|
|
1 | (26) |
|
|
2 | (3) |
|
|
5 | (2) |
|
|
7 | (2) |
|
OpenGL as a State Machine |
|
|
9 | (1) |
|
OpenGL Rendering Pipeline |
|
|
10 | (4) |
|
|
11 | (1) |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
12 | (1) |
|
|
12 | (1) |
|
|
13 | (1) |
|
|
13 | (1) |
|
|
13 | (1) |
|
|
14 | (7) |
|
|
15 | (1) |
|
GLUT, the OpenGL Utility Toolkit |
|
|
16 | (5) |
|
|
21 | (6) |
|
|
22 | (1) |
|
|
23 | (4) |
|
State Management and Drawing Geometric Objects |
|
|
27 | (70) |
|
|
29 | (8) |
|
|
30 | (2) |
|
|
32 | (2) |
|
Forcing Completion of Drawing |
|
|
34 | (2) |
|
Coordinate System Survival Kit |
|
|
36 | (1) |
|
Describing Points, Lines, and Polygons |
|
|
37 | (12) |
|
What Are Points, Lines, and Polygons? |
|
|
37 | (5) |
|
|
42 | (1) |
|
OpenGL Geometric Drawing Primitives |
|
|
43 | (6) |
|
|
49 | (2) |
|
Displaying Points, Lines, and Polygons |
|
|
51 | (13) |
|
|
51 | (1) |
|
|
52 | (4) |
|
|
56 | (8) |
|
|
64 | (2) |
|
|
66 | (17) |
|
|
68 | (1) |
|
Step 2: Specifying Data for the Arrays |
|
|
69 | (4) |
|
Step 3: Dereferencing and Rendering |
|
|
73 | (7) |
|
|
80 | (3) |
|
|
83 | (3) |
|
Some Hints for Building Polygonal Models of Surfaces |
|
|
86 | (11) |
|
An Example: Building an Icosahedron |
|
|
88 | (9) |
|
|
97 | (62) |
|
Overview: The Camera Analogy |
|
|
100 | (11) |
|
A Simple Example: Drawing a Cube |
|
|
103 | (5) |
|
General-Purpose Transformation Commands |
|
|
108 | (3) |
|
Viewing and Modeling Transformations |
|
|
111 | (16) |
|
Thinking about Transformations |
|
|
111 | (3) |
|
|
114 | (6) |
|
|
120 | (7) |
|
Projection Transformatons |
|
|
127 | (6) |
|
|
128 | (3) |
|
|
131 | (1) |
|
|
132 | (1) |
|
|
133 | (3) |
|
|
133 | (2) |
|
The Transformed Depth Coordinate |
|
|
135 | (1) |
|
Troubleshooting Transformations |
|
|
136 | (3) |
|
Manipulating the Matrix Stacks |
|
|
139 | (5) |
|
The Modelview Matrix Stack |
|
|
143 | (1) |
|
The Projection Matrix Stack |
|
|
143 | (1) |
|
Additional Clipping Planes |
|
|
144 | (3) |
|
Examples of Composing Several Transformations |
|
|
147 | (8) |
|
|
148 | (3) |
|
Building an Articulated Robot Arm |
|
|
151 | (4) |
|
Reversing or Mimicking Transformations |
|
|
155 | (4) |
|
|
159 | (18) |
|
|
160 | (2) |
|
|
162 | (2) |
|
RGBA versus Color-Index Mode |
|
|
164 | (6) |
|
|
165 | (2) |
|
|
167 | (2) |
|
Choosing between RGBA and Color-Index Mode |
|
|
169 | (1) |
|
Changing between Display Modes |
|
|
170 | (1) |
|
Specifying a Color and a Shading Model |
|
|
170 | (7) |
|
Specifying a Color in RGBA Mode |
|
|
171 | (1) |
|
Specifying a Color in Color-Index Mode |
|
|
172 | (1) |
|
Specifying a Shading Model |
|
|
173 | (4) |
|
|
177 | (46) |
|
A Hidden-Surface Removal Survival Kit |
|
|
179 | (2) |
|
Real-World and OpenGL Lighting |
|
|
181 | (3) |
|
Ambient, Diffuse, Specular, and Emissive Light |
|
|
182 | (1) |
|
|
183 | (1) |
|
RGB Values for Lights and Materials |
|
|
183 | (1) |
|
A Simple Example: Rendering a Lit Sphere |
|
|
184 | (4) |
|
|
188 | (13) |
|
|
190 | (1) |
|
|
191 | (2) |
|
|
193 | (1) |
|
|
194 | (1) |
|
Controlling a Light's Position and Direction |
|
|
195 | (6) |
|
Selecting a Lighting Model |
|
|
201 | (4) |
|
|
202 | (1) |
|
Local or Infinite Viewpoint |
|
|
203 | (1) |
|
|
203 | (1) |
|
|
204 | (1) |
|
|
205 | (1) |
|
Defining Material Properties |
|
|
205 | (9) |
|
Diffuse and Ambient Reflection |
|
|
207 | (1) |
|
|
208 | (1) |
|
|
208 | (1) |
|
Changing Material Properties |
|
|
209 | (2) |
|
|
211 | (3) |
|
The Mathematics of Lighting |
|
|
214 | (6) |
|
|
215 | (1) |
|
Scaled Global Ambient Light |
|
|
216 | (1) |
|
Contributions from Light Sources |
|
|
216 | (2) |
|
|
218 | (1) |
|
|
219 | (1) |
|
Lighting in Color-Index Mode |
|
|
220 | (3) |
|
The Mathematics of Color-Index Mode Lighting |
|
|
221 | (2) |
|
Blending, Antialiasing, Fog, and Polygon Offset |
|
|
223 | (48) |
|
|
225 | (16) |
|
The Source and Destination Factors |
|
|
226 | (3) |
|
|
229 | (1) |
|
Combining Pixels Using Blending Equations |
|
|
229 | (3) |
|
|
232 | (2) |
|
|
234 | (3) |
|
Three-Dimensional Blending with the Depth Buffer |
|
|
237 | (4) |
|
|
241 | (14) |
|
Antialiasing Points or Lines |
|
|
243 | (6) |
|
Antialiasing Geometric Primitives with Multisampling |
|
|
249 | (4) |
|
|
253 | (2) |
|
|
255 | (10) |
|
|
255 | (3) |
|
|
258 | (7) |
|
|
265 | (3) |
|
|
268 | (3) |
|
|
271 | (24) |
|
|
272 | (1) |
|
An Example of Using a Display List |
|
|
273 | (3) |
|
Display List Design Philosophy |
|
|
276 | (3) |
|
Creating and Executing a Display List |
|
|
279 | (7) |
|
Naming and Creating a Display List |
|
|
280 | (1) |
|
What's Stored in a Display List? |
|
|
281 | (2) |
|
|
283 | (1) |
|
Hierarchical Display Lists |
|
|
284 | (1) |
|
Managing Display List Indices |
|
|
285 | (1) |
|
Executing Multiple Display Lists |
|
|
286 | (6) |
|
Managing State Variables with Display Lists |
|
|
292 | (3) |
|
Encapsulating Mode Changes |
|
|
293 | (2) |
|
Drawing Pixels, Bitmaps, Fonts, and Images |
|
|
295 | (64) |
|
|
297 | (9) |
|
The Current Raster Position |
|
|
299 | (1) |
|
|
300 | (2) |
|
Choosing a Color for the Bitmap |
|
|
302 | (1) |
|
|
303 | (1) |
|
Defining and Using a Complete Font |
|
|
304 | (2) |
|
|
306 | (9) |
|
Reading, Writing, and Copying Pixel Data |
|
|
307 | (8) |
|
|
315 | (16) |
|
Pixel Packing and Unpacking |
|
|
318 | (1) |
|
Controlling Pixel-Storage Modes |
|
|
319 | (5) |
|
Pixel-Transfer Operations |
|
|
324 | (3) |
|
|
327 | (1) |
|
Magnifying, Reducing, or Flipping an Image |
|
|
328 | (3) |
|
Reading and Drawing Pixel Rectangles |
|
|
331 | (4) |
|
The Pixel Rectangle Drawing Process |
|
|
332 | (3) |
|
Tips for Improving Pixel Drawing Rates |
|
|
335 | (1) |
|
|
336 | (23) |
|
|
338 | (5) |
|
|
343 | (8) |
|
|
351 | (2) |
|
|
353 | (3) |
|
|
356 | (3) |
|
|
359 | (92) |
|
An Overview and an Example |
|
|
364 | (5) |
|
|
365 | (1) |
|
|
366 | (3) |
|
|
369 | (31) |
|
|
374 | (2) |
|
Replacing All or Part of a Texture Image |
|
|
376 | (3) |
|
|
379 | (2) |
|
Three-Dimensional Textures |
|
|
381 | (5) |
|
Compressed Texture Images |
|
|
386 | (3) |
|
Using a Texture's Borders |
|
|
389 | (1) |
|
Mipmaps: Multiple Levels of Detail |
|
|
389 | (11) |
|
|
400 | (3) |
|
|
403 | (7) |
|
|
404 | (1) |
|
Creating and Using Texture Objects |
|
|
404 | (3) |
|
Cleaning Up Texture Objects |
|
|
407 | (1) |
|
A Working Set of Resident Textures |
|
|
408 | (2) |
|
|
410 | (4) |
|
Assigning Texture Coordinates |
|
|
414 | (8) |
|
Computing Appropriate Texture Coordinates |
|
|
415 | (2) |
|
Repeating and Clamping Textures |
|
|
417 | (5) |
|
Automatic Texture-Coordinate Generation |
|
|
422 | (10) |
|
|
423 | (5) |
|
|
428 | (2) |
|
|
430 | (2) |
|
|
432 | (5) |
|
Texture Combiner Functions |
|
|
437 | (6) |
|
The Interpolation Combiner Function |
|
|
442 | (1) |
|
Applying Secondary Color after Texturing |
|
|
443 | (1) |
|
Secondary Color When Lighting Is Disabled |
|
|
444 | (1) |
|
Secondary Specular Color When Lighting Is Enabled |
|
|
444 | (1) |
|
|
444 | (2) |
|
|
446 | (5) |
|
|
447 | (1) |
|
Generating Texture Coordinates and Rendering |
|
|
448 | (3) |
|
|
451 | (36) |
|
|
454 | (7) |
|
|
455 | (1) |
|
|
456 | (1) |
|
Selecting Color Buffers for Writing and Reading |
|
|
457 | (2) |
|
|
459 | (2) |
|
Testing and Operating on Fragments |
|
|
461 | (12) |
|
|
462 | (1) |
|
|
462 | (2) |
|
|
464 | (5) |
|
|
469 | (1) |
|
Blending, Dithering, and Logical Operations |
|
|
470 | (3) |
|
|
473 | (14) |
|
|
474 | (6) |
|
|
480 | (1) |
|
|
481 | (4) |
|
|
485 | (1) |
|
|
486 | (1) |
|
Tessellators and Quadrics |
|
|
487 | (28) |
|
|
488 | (17) |
|
Creating a Tessellation Object |
|
|
490 | (1) |
|
Tessellation Callback Routines |
|
|
490 | (5) |
|
|
495 | (5) |
|
|
500 | (3) |
|
Deleting a Tessellation Object |
|
|
503 | (1) |
|
Tessellation Performance Tips |
|
|
503 | (1) |
|
|
504 | (1) |
|
|
504 | (1) |
|
Quadrics: Rendering Spheres, Cylinders, and Disks |
|
|
505 | (10) |
|
Managing Quadrics Objects |
|
|
506 | (1) |
|
Controlling Quadrics Attributes |
|
|
507 | (2) |
|
|
509 | (6) |
|
|
515 | (36) |
|
|
517 | (1) |
|
|
518 | (14) |
|
One-Dimensional Evaluators |
|
|
518 | (6) |
|
Two-Dimensional Evaluators |
|
|
524 | (6) |
|
Using Evaluators for Textures |
|
|
530 | (2) |
|
|
532 | (19) |
|
|
532 | (5) |
|
|
537 | (4) |
|
Creating a NURBS Curve or Surface |
|
|
541 | (6) |
|
|
547 | (4) |
|
|
551 | (30) |
|
|
552 | (21) |
|
|
553 | (1) |
|
|
554 | (2) |
|
|
556 | (1) |
|
|
557 | (3) |
|
|
560 | (11) |
|
Hints for Writing a Program That Uses Selection |
|
|
571 | (2) |
|
|
573 | (8) |
|
|
575 | (1) |
|
Using Markers in Feedback Mode |
|
|
576 | (1) |
|
|
576 | (5) |
|
|
581 | (32) |
|
|
583 | (2) |
|
Which Version Am I Using? |
|
|
585 | (2) |
|
|
586 | (1) |
|
Window System Extension Versions |
|
|
587 | (1) |
|
Extensions to the Standard |
|
|
587 | (3) |
|
Extensions to the Standard for Microsoft Windows (WGL) |
|
|
589 | (1) |
|
|
590 | (1) |
|
|
590 | (2) |
|
Object Selection Using the Back Buffer |
|
|
592 | (1) |
|
Cheap Image Transformation |
|
|
593 | (1) |
|
|
594 | (1) |
|
|
595 | (3) |
|
|
598 | (1) |
|
|
598 | (1) |
|
|
598 | (2) |
|
Drawing Filled, Concave Polygons Using the Stencil Buffer |
|
|
600 | (1) |
|
Finding Interference Regions |
|
|
601 | (2) |
|
|
603 | (1) |
|
|
604 | (2) |
|
Hidden-Line Removal with Polygon Offset |
|
|
604 | (1) |
|
Hidden-Line Removal with the Stencil Buffer |
|
|
605 | (1) |
|
Texture Mapping Applications |
|
|
606 | (1) |
|
Drawing Depth-Buffered Images |
|
|
607 | (1) |
|
|
608 | (1) |
|
Life in the Stencil Buffer |
|
|
609 | (2) |
|
Alternative Uses for glDrawPixels() and glCopyPixels() |
|
|
611 | (2) |
|
|
613 | (6) |
|
|
614 | (1) |
|
|
615 | (1) |
|
|
615 | (1) |
|
|
616 | (1) |
|
|
616 | (1) |
|
|
617 | (1) |
|
|
617 | (1) |
|
|
618 | (1) |
|
|
619 | (40) |
|
|
620 | (1) |
|
|
621 | (38) |
|
Current Values and Associated Data |
|
|
623 | (1) |
|
|
624 | (4) |
|
|
628 | (2) |
|
|
630 | (1) |
|
|
631 | (2) |
|
|
633 | (2) |
|
|
635 | (1) |
|
|
636 | (6) |
|
|
642 | (2) |
|
|
644 | (1) |
|
|
645 | (6) |
|
|
651 | (1) |
|
|
652 | (1) |
|
Implementation-Dependent Values |
|
|
653 | (4) |
|
Implementation-Dependent Pixel Depths |
|
|
657 | (1) |
|
|
657 | (2) |
|
C. OpenGL and Window Systems |
|
|
659 | (24) |
|
Accessing New OpenGL Functions |
|
|
660 | (1) |
|
GLX: OpenGL Extension for the X Window System |
|
|
661 | (7) |
|
|
662 | (1) |
|
|
663 | (2) |
|
|
665 | (3) |
|
AGL: OpenGL Extensions for the Apple Macintosh |
|
|
668 | (6) |
|
|
669 | (1) |
|
|
669 | (1) |
|
Managing an OpenGL Rendering Context |
|
|
669 | (1) |
|
|
670 | (1) |
|
|
670 | (1) |
|
|
670 | (1) |
|
|
670 | (1) |
|
Updating the Rendering Buffers |
|
|
670 | (1) |
|
Using an Apple Macintosh Font |
|
|
671 | (1) |
|
|
671 | (1) |
|
|
671 | (3) |
|
PGL: OpenGL Extension for IBM OS/2 Warp |
|
|
674 | (3) |
|
|
674 | (1) |
|
|
674 | (2) |
|
|
676 | (1) |
|
WGL: OpenGL Extension for Microsoft |
|
|
|
Windows 95/98/NT/ME/2000/XP |
|
|
677 | (6) |
|
|
678 | (1) |
|
|
678 | (2) |
|
|
680 | (3) |
|
D. Basics of GLUT: The OpenGL Utility Toolkit |
|
|
683 | (8) |
|
Initializing and Creating a Window |
|
|
684 | (1) |
|
Handling Window and Input Events |
|
|
685 | (2) |
|
|
687 | (1) |
|
Initializing and Drawing Three-Dimensional Objects |
|
|
687 | (2) |
|
Managing a Background Process |
|
|
689 | (1) |
|
|
689 | (2) |
|
E. Calculating Normal Vectors |
|
|
691 | (6) |
|
Finding Normals for Analytic Surfaces |
|
|
693 | (2) |
|
Finding Normals from Polygonal Data |
|
|
695 | (2) |
|
F. Homogeneous Coordinates and Transformation Matrices |
|
|
697 | (6) |
|
|
698 | (1) |
|
|
698 | (1) |
|
|
699 | (1) |
|
|
699 | (4) |
|
|
700 | (1) |
|
|
700 | (1) |
|
|
700 | (1) |
|
|
701 | (1) |
|
|
702 | (1) |
|
|
703 | (6) |
|
|
704 | (2) |
|
|
706 | (2) |
|
|
708 | (1) |
|
|
709 | (4) |
Glossary |
|
713 | (22) |
Index |
|
735 | |