|
|
xxi | |
|
|
xxv | |
Examples |
|
xxix | |
About This Guide |
|
xxxv | |
What This Guide Contains |
|
xxxv | |
What's New in This Edition |
|
xxxviii | |
What You Should Know Before Reading This Guide |
|
xxxviii | |
How to Obtain the Sample Code |
|
xl | |
Nate Robins' OpenGL Tutors |
|
xl | |
Errata |
|
xl | |
Style Conventions |
|
xli | |
Acknowledgments |
|
xliii | |
|
|
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 | (6) |
|
|
15 | (1) |
|
GLUT, the OpenGL Utility Toolkit |
|
|
16 | (4) |
|
|
20 | (7) |
|
|
22 | (1) |
|
|
23 | (4) |
|
State Management and Drawing Geometric Objects |
|
|
27 | (76) |
|
|
29 | (8) |
|
|
30 | (2) |
|
|
32 | (2) |
|
Forcing Completion of Drawing |
|
|
34 | (2) |
|
Coordinate System Survival Kit |
|
|
36 | (1) |
|
Describing Points, Lines, and Polygons |
|
|
37 | (11) |
|
What Are Points, Lines, and Polygons? |
|
|
37 | (4) |
|
|
41 | (1) |
|
OpenGL Geometric Drawing Primitives |
|
|
42 | (6) |
|
|
48 | (2) |
|
Displaying Points, Lines, and Polygons |
|
|
50 | (13) |
|
|
50 | (1) |
|
|
51 | (4) |
|
|
55 | (8) |
|
|
63 | (2) |
|
|
65 | (17) |
|
|
67 | (1) |
|
Step 2: Specifying Data for the Arrays |
|
|
68 | (3) |
|
Step 3: Dereferencing and Rendering |
|
|
71 | (7) |
|
|
78 | (4) |
|
Vertex Arrays in Buffer Objects |
|
|
82 | (8) |
|
Utilizing Buffer Objects with Vertex-Array Data |
|
|
82 | (1) |
|
Creating Buffer Objects for Vertex Data |
|
|
83 | (1) |
|
Making a Buffer Object Active |
|
|
83 | (1) |
|
Allocating and Initializing Buffer Objects with Vertex Data |
|
|
84 | (4) |
|
Updating Data Values in Buffer Objects |
|
|
88 | (2) |
|
Cleaning up Buffer Objects |
|
|
90 | (1) |
|
|
90 | (3) |
|
Some Hints for Building Polygonal Models of Surfaces |
|
|
93 | (10) |
|
An Example: Building an Icosahedron |
|
|
95 | (8) |
|
|
103 | (62) |
|
Overview: The Camera Analogy |
|
|
106 | (11) |
|
A Simple Example: Drawing a Cube |
|
|
109 | (5) |
|
General-Purpose Transformation Commands |
|
|
114 | (3) |
|
Viewing and Modeling Transformations |
|
|
117 | (16) |
|
Thinking about Transformations |
|
|
117 | (3) |
|
|
120 | (6) |
|
|
126 | (7) |
|
Projection Transformations |
|
|
133 | (5) |
|
|
133 | (3) |
|
|
136 | (2) |
|
|
138 | (1) |
|
|
138 | (4) |
|
|
139 | (2) |
|
The Transformed Depth Coordinate |
|
|
141 | (1) |
|
Troubleshooting Transformations |
|
|
142 | (3) |
|
Manipulating the Matrix Stacks |
|
|
145 | (4) |
|
The Modelview Matrix Stack |
|
|
148 | (1) |
|
The Projection Matrix Stack |
|
|
148 | (1) |
|
Additional Clipping Planes |
|
|
149 | (3) |
|
Examples of Composing Several Transformations |
|
|
152 | (8) |
|
|
153 | (3) |
|
Building an Articulated Robot Arm |
|
|
156 | (4) |
|
Reversing or Mimicking Transformations |
|
|
160 | (5) |
|
|
165 | (18) |
|
|
166 | (2) |
|
|
168 | (2) |
|
RGBA versus Color-Index Mode |
|
|
170 | (6) |
|
|
171 | (2) |
|
|
173 | (2) |
|
Choosing between RGBA and Color-Index Mode |
|
|
175 | (1) |
|
Changing between Display Modes |
|
|
176 | (1) |
|
Specifying a Color and a Shading Model |
|
|
176 | (7) |
|
Specifying a Color in RGBA Mode |
|
|
177 | (1) |
|
Specifying a Color in Color-Index Mode |
|
|
178 | (1) |
|
Specifying a Shading Model |
|
|
179 | (4) |
|
|
183 | (46) |
|
A Hidden-Surface Removal Survival Kit |
|
|
185 | (2) |
|
Real-World and OpenGL Lighting |
|
|
187 | (3) |
|
Ambient, Diffuse, Specular, and Emissive Light |
|
|
188 | (1) |
|
|
189 | (1) |
|
RGB Values for Lights and Materials |
|
|
189 | (1) |
|
A Simple Example: Rendering a Lit Sphere |
|
|
190 | (4) |
|
|
194 | (13) |
|
|
196 | (1) |
|
|
197 | (2) |
|
|
199 | (1) |
|
|
200 | (1) |
|
Controlling a Light's Position and Direction |
|
|
201 | (6) |
|
Selecting a Lighting Model |
|
|
207 | (4) |
|
|
208 | (1) |
|
Local or Infinite Viewpoint |
|
|
209 | (1) |
|
|
209 | (1) |
|
|
210 | (1) |
|
|
211 | (1) |
|
Defining Material Properties |
|
|
211 | (9) |
|
Diffuse and Ambient Reflection |
|
|
213 | (1) |
|
|
214 | (1) |
|
|
214 | (1) |
|
Changing Material Properties |
|
|
215 | (2) |
|
|
217 | (3) |
|
The Mathematics of Lighting |
|
|
220 | (6) |
|
|
221 | (1) |
|
Scaled Global Ambient Light |
|
|
222 | (1) |
|
Contributions from Light Sources |
|
|
222 | (2) |
|
|
224 | (1) |
|
|
225 | (1) |
|
Lighting in Color-Index Mode |
|
|
226 | (3) |
|
The Mathematics of Color-Index Mode Lighting |
|
|
227 | (2) |
|
Blending, Antialiasing, Fog, and Polygon Offset |
|
|
229 | (48) |
|
|
231 | (16) |
|
The Source and Destination Factors |
|
|
232 | (3) |
|
|
235 | (1) |
|
Combining Pixels Using Blending Equations |
|
|
235 | (3) |
|
|
238 | (2) |
|
|
240 | (3) |
|
Three-Dimensional Blending with the Depth Buffer |
|
|
243 | (4) |
|
|
247 | (14) |
|
Antialiasing Points or Lines |
|
|
249 | (6) |
|
Antialiasing Geometric Primitives with Multisampling |
|
|
255 | (4) |
|
|
259 | (2) |
|
|
261 | (10) |
|
|
261 | (3) |
|
|
264 | (7) |
|
|
271 | (3) |
|
|
274 | (3) |
|
|
277 | (24) |
|
|
278 | (1) |
|
An Example of Using a Display List |
|
|
279 | (3) |
|
Display List Design Philosophy |
|
|
282 | (3) |
|
Creating and Executing a Display List |
|
|
285 | (7) |
|
Naming and Creating a Display List |
|
|
286 | (1) |
|
What's Stored in a Display List? |
|
|
287 | (2) |
|
|
289 | (1) |
|
Hierarchical Display Lists |
|
|
290 | (1) |
|
Managing Display List Indices |
|
|
291 | (1) |
|
Executing Multiple Display Lists |
|
|
292 | (5) |
|
Managing State Variables with Display Lists |
|
|
297 | (4) |
|
Encapsulating Mode Changes |
|
|
299 | (2) |
|
Drawing Pixels, Bitmaps, Fonts, and Images |
|
|
301 | (64) |
|
|
303 | (9) |
|
The Current Raster Position |
|
|
305 | (1) |
|
|
306 | (2) |
|
Choosing a Color for the Bitmap |
|
|
308 | (1) |
|
|
309 | (1) |
|
Defining and Using a Complete Font |
|
|
310 | (2) |
|
|
312 | (9) |
|
Reading, Writing, and Copying Pixel Data |
|
|
313 | (8) |
|
|
321 | (16) |
|
Pixel Packing and Unpacking |
|
|
324 | (1) |
|
Controlling Pixel-Storage Modes |
|
|
325 | (5) |
|
Pixel-Transfer Operations |
|
|
330 | (3) |
|
|
333 | (1) |
|
Magnifying, Reducing, or Flipping an Image |
|
|
334 | (3) |
|
Reading and Drawing Pixel Rectangles |
|
|
337 | (4) |
|
The Pixel Rectangle Drawing Process |
|
|
338 | (3) |
|
Tips for Improving Pixel Drawing Rates |
|
|
341 | (1) |
|
|
342 | (23) |
|
|
344 | (5) |
|
|
349 | (8) |
|
|
357 | (2) |
|
|
359 | (3) |
|
|
362 | (3) |
|
|
365 | (92) |
|
An Overview and an Example |
|
|
371 | (4) |
|
|
371 | (1) |
|
|
372 | (3) |
|
|
375 | (31) |
|
|
380 | (2) |
|
Replacing All or Part of a Texture Image |
|
|
382 | (3) |
|
|
385 | (2) |
|
Three-Dimensional Textures |
|
|
387 | (5) |
|
Compressed Texture Images |
|
|
392 | (3) |
|
Using a Texture's Borders |
|
|
395 | (1) |
|
Mipmaps: Multiple Levels of Detail |
|
|
395 | (11) |
|
|
406 | (3) |
|
|
409 | (7) |
|
|
410 | (1) |
|
Creating and Using Texture Objects |
|
|
410 | (3) |
|
Cleaning Up Texture Objects |
|
|
413 | (1) |
|
A Working Set of Resident Textures |
|
|
414 | (2) |
|
|
416 | (4) |
|
Assigning Texture Coordinates |
|
|
420 | (9) |
|
Computing Appropriate Texture Coordinates |
|
|
422 | (1) |
|
Repeating and Clamping Textures |
|
|
423 | (6) |
|
Automatic Texture-Coordinate Generation |
|
|
429 | (9) |
|
|
430 | (4) |
|
|
434 | (2) |
|
|
436 | (2) |
|
|
438 | (6) |
|
Texture Combiner Functions |
|
|
444 | (6) |
|
The Interpolation Combiner Function |
|
|
448 | (2) |
|
Applying Secondary Color after Texturing |
|
|
450 | (1) |
|
Secondary Color When Lighting Is Disabled |
|
|
450 | (1) |
|
Secondary Specular Color When Lighting Is Enabled |
|
|
450 | (1) |
|
|
451 | (1) |
|
|
452 | (5) |
|
|
453 | (1) |
|
Generating Texture Coordinates and Rendering |
|
|
454 | (3) |
|
|
457 | (40) |
|
|
460 | (7) |
|
|
461 | (1) |
|
|
462 | (1) |
|
Selecting Color Buffers for Writing and Reading |
|
|
463 | (2) |
|
|
465 | (2) |
|
Testing and Operating on Fragments |
|
|
467 | (15) |
|
|
468 | (1) |
|
|
468 | (2) |
|
|
470 | (5) |
|
|
475 | (1) |
|
|
476 | (3) |
|
Blending, Dithering, and Logical Operations |
|
|
479 | (3) |
|
|
482 | (15) |
|
|
483 | (6) |
|
|
489 | (1) |
|
|
489 | (5) |
|
|
494 | (1) |
|
|
494 | (3) |
|
Tessellators and Quadrics |
|
|
497 | (28) |
|
|
498 | (17) |
|
Creating a Tessellation Object |
|
|
500 | (1) |
|
Tessellation Callback Routines |
|
|
500 | (5) |
|
|
505 | (5) |
|
|
510 | (3) |
|
Deleting a Tessellation Object |
|
|
513 | (1) |
|
Tessellation Performance Tips |
|
|
513 | (1) |
|
|
514 | (1) |
|
|
514 | (1) |
|
Quadrics: Rendering Spheres, Cylinders, and Disks |
|
|
515 | (10) |
|
Managing Quadrics Objects |
|
|
516 | (1) |
|
Controlling Quadrics Attributes |
|
|
517 | (2) |
|
|
519 | (6) |
|
|
525 | (36) |
|
|
527 | (1) |
|
|
528 | (14) |
|
One-Dimensional Evaluators |
|
|
528 | (6) |
|
Two-Dimensional Evaluators |
|
|
534 | (6) |
|
Using Evaluators for Textures |
|
|
540 | (2) |
|
|
542 | (19) |
|
|
542 | (5) |
|
|
547 | (4) |
|
Creating a NURBS Curve or Surface |
|
|
551 | (6) |
|
|
557 | (4) |
|
|
561 | (30) |
|
|
562 | (21) |
|
|
563 | (1) |
|
|
564 | (2) |
|
|
566 | (1) |
|
|
567 | (3) |
|
|
570 | (11) |
|
Hints for Writing a Program That Uses Selection |
|
|
581 | (2) |
|
|
583 | (8) |
|
|
585 | (1) |
|
Using Markers in Feedback Mode |
|
|
586 | (1) |
|
|
586 | (5) |
|
|
591 | (32) |
|
|
593 | (2) |
|
Which Version Am I Using? |
|
|
595 | (2) |
|
|
596 | (1) |
|
Window System Extension Versions |
|
|
597 | (1) |
|
Extensions to the Standard |
|
|
597 | (3) |
|
Extensions to the Standard for Microsoft Windows (WGL) |
|
|
599 | (1) |
|
|
600 | (1) |
|
|
600 | (2) |
|
Object Selection Using the Back Buffer |
|
|
602 | (1) |
|
Cheap Image Transformation |
|
|
603 | (1) |
|
|
604 | (1) |
|
|
605 | (3) |
|
|
608 | (1) |
|
|
608 | (1) |
|
|
608 | (2) |
|
Drawing Filled, Concave Polygons Using the Stencil Buffer |
|
|
610 | (1) |
|
Finding Interference Regions |
|
|
611 | (2) |
|
|
613 | (1) |
|
|
614 | (2) |
|
Hidden-Line Removal with Polygon Offset |
|
|
614 | (1) |
|
Hidden-Line Removal with the Stencil Buffer |
|
|
615 | (1) |
|
Texture Mapping Applications |
|
|
616 | (1) |
|
Drawing Depth-Buffered Images |
|
|
617 | (1) |
|
|
617 | (2) |
|
Life in the Stencil Buffer |
|
|
619 | (1) |
|
Alternative Uses for glDrawPixels() and glCopyPixels() |
|
|
620 | (3) |
|
OpenGL 2.0 and the OpenGL Shading Language |
|
|
623 | (42) |
|
|
624 | (1) |
|
|
624 | (2) |
|
The OpenGL Graphics Pipeline and Programmable Shading |
|
|
626 | (4) |
|
|
627 | (2) |
|
|
629 | (1) |
|
|
630 | (8) |
|
|
630 | (1) |
|
|
631 | (7) |
|
The OpenGL Shading Language |
|
|
638 | (1) |
|
Creating Shaders with GLSL |
|
|
639 | (14) |
|
|
639 | (1) |
|
|
639 | (2) |
|
|
641 | (7) |
|
|
648 | (3) |
|
|
651 | (2) |
|
Using OpenGL State Values in GLSL Programs |
|
|
653 | (1) |
|
Accessing Texture Maps in Shaders |
|
|
653 | (12) |
|
|
655 | (7) |
|
|
662 | (3) |
|
|
665 | (6) |
|
|
666 | (1) |
|
|
667 | (1) |
|
|
667 | (1) |
|
|
668 | (1) |
|
|
668 | (1) |
|
|
669 | (1) |
|
|
669 | (1) |
|
|
670 | (1) |
|
|
671 | (42) |
|
|
672 | (2) |
|
|
674 | (39) |
|
Current Values and Associated Data |
|
|
676 | (1) |
|
|
677 | (4) |
|
|
681 | (2) |
|
|
683 | (1) |
|
|
684 | (2) |
|
|
686 | (2) |
|
|
688 | (1) |
|
|
689 | (6) |
|
|
695 | (2) |
|
|
697 | (1) |
|
|
698 | (6) |
|
|
704 | (1) |
|
|
705 | (1) |
|
Implementation-Dependent Values |
|
|
706 | (4) |
|
Implementation-Dependent Pixel Depths |
|
|
710 | (1) |
|
|
710 | (3) |
|
C. OpenGL and Window Systems |
|
|
713 | (24) |
|
Accessing New OpenGL Functions |
|
|
714 | (1) |
|
GLX: OpenGL Extension for the X Window System |
|
|
715 | (7) |
|
|
716 | (1) |
|
|
717 | (2) |
|
|
719 | (3) |
|
AGL: OpenGL Extensions for the Apple Macintosh |
|
|
722 | (5) |
|
|
722 | (1) |
|
|
723 | (1) |
|
Managing an OpenGL Rendering Context |
|
|
723 | (1) |
|
|
723 | (1) |
|
|
724 | (1) |
|
|
724 | (1) |
|
|
724 | (1) |
|
Updating the Rendering Buffers |
|
|
724 | (1) |
|
Using an Apple Macintosh Font |
|
|
724 | (1) |
|
|
725 | (1) |
|
|
725 | (2) |
|
PGL: OpenGL Extension for IBM OS/2 Warp |
|
|
727 | (4) |
|
|
727 | (1) |
|
|
728 | (1) |
|
|
729 | (2) |
|
WGL: OpenGL Extension for Microsoft Windows 95/98/NT/ME/2000/XP |
|
|
731 | (6) |
|
|
731 | (1) |
|
|
732 | (1) |
|
|
733 | (4) |
|
D. Basics of GLUT: The OpenGL Utility Toolkit |
|
|
737 | (8) |
|
Initializing and Creating a Window |
|
|
738 | (1) |
|
Handling Window and Input Events |
|
|
739 | (2) |
|
|
741 | (1) |
|
Initializing and Drawing Three-Dimensional Objects |
|
|
741 | (2) |
|
Managing a Background Process |
|
|
743 | (1) |
|
|
743 | (2) |
|
E. Calculating Normal Vectors |
|
|
745 | (6) |
|
Finding Normals for Analytic Surfaces |
|
|
747 | (2) |
|
Finding Normals from Polygonal Data |
|
|
749 | (2) |
|
F. Homogeneous Coordinates and Transformation Matrices |
|
|
751 | (6) |
|
|
752 | (1) |
|
|
752 | (1) |
|
|
753 | (1) |
|
|
753 | (4) |
|
|
754 | (1) |
|
|
754 | (1) |
|
|
754 | (1) |
|
|
755 | (1) |
|
|
756 | (1) |
|
|
757 | (6) |
|
|
758 | (2) |
|
|
760 | (2) |
|
|
762 | (1) |
|
|
763 | (4) |
|
I. Built-in OpenGL Shading Language Variables and Functions |
|
|
767 | (24) |
|
|
768 | (12) |
|
Vertex Shader Input Attributes Variables |
|
|
768 | (1) |
|
Vertex Shader Special Output Variables |
|
|
768 | (1) |
|
Vertex Shader Output Varying Variables |
|
|
769 | (1) |
|
Built-in Implementation Constants |
|
|
770 | (1) |
|
Built-In Uniform State Variables |
|
|
771 | (9) |
|
|
780 | (11) |
|
Angle Conversion and Trigonometric Functions |
|
|
780 | (1) |
|
|
781 | (1) |
|
Basic Numerical Functions |
|
|
782 | (1) |
|
Vector-Operation Functions |
|
|
783 | (1) |
|
|
784 | (1) |
|
Vector-Component Relational Functions |
|
|
784 | (1) |
|
|
785 | (5) |
|
Fragment Processing Functions |
|
|
790 | (1) |
|
|
790 | (1) |
Glossary |
|
791 | (22) |
Index |
|
813 | |