Table of contents for OpenGL programming guide : the official guide to learning OpenGL, version 2.1 / OpenGL Architecture Review Board, Dave Shreiner ... [et al.].

Bibliographic record and links to related information available from the Library of Congress catalog.

Note: Contents data are machine generated based on pre-publication provided by the publisher. Contents may have variations from the printed book or be incomplete or contain other coding.


Counter
Contents
	Figures 	xxi
	Tables 	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.	Introduction to OpenGL	1
What Is OpenGL?	2
A Smidgen of OpenGL Code	5
OpenGL Command Syntax	7
OpenGL as a State Machine	9
OpenGL Rendering Pipeline	10
Display Lists	11
Evaluators	11
Per-Vertex Operations	12
Primitive Assembly	12
Pixel Operations	12
Texture Assembly	13
Rasterization	13
Fragment Operations	13
OpenGL-Related Libraries	14
Include Files	15
GLUT, the OpenGL Utility Toolkit	16
Animation	20
The Refresh That Pauses	22
Motion = Redraw + Swap	23
2.	State Management and Drawing Geometric Objects	27
A Drawing Survival Kit	29
Clearing the Window	30
Specifying a Color	32
Forcing Completion of Drawing	34
Coordinate System Survival Kit	36
Describing Points, Lines, and Polygons	37
What Are Points, Lines, and Polygons?	37
Specifying Vertices	41
OpenGL Geometric Drawing Primitives	42
Basic State Management	48
Displaying Points, Lines, and Polygons	50
Point Details	50
Line Details	51
Polygon Details	55
Normal Vectors	63
Vertex Arrays	65
Step 1: Enabling Arrays	67
Step 2: Specifying Data for the Arrays	68
Step 3: Dereferencing and Rendering	71
Interleaved Arrays	78
Vertex Arrays in Buffer Objects	82
Utilizing Buffer Objects with Vertex-Array Data	82
Creating Buffer Objects for Vertex Data	83
Making a Buffer Object Active	83
Allocating and Initializing Buffer Objects with Vertex Data	84
Updating Data Values in Buffer Objects	88
Cleaning up Buffer Objects	90
Attribute Groups	90
Some Hints for Building Polygonal Models of Surfaces	93
An Example: Building an Icosahedron	95
3.	Viewing	103
Overview: The Camera Analogy	106
A Simple Example: Drawing a Cube	109
General-Purpose Transformation Commands	114
Viewing and Modeling Transformations	117
Thinking about Transformations	117
Modeling Transformations	120
Viewing Transformations	126
Projection Transformations	133
Perspective Projection	133
Orthographic Projection	136
Viewing Volume Clipping	138
Viewport Transformation	138
Defining the Viewport 	39
The Transformed Depth Coordinate	141
Troubleshooting Transformations	142
Manipulating the Matrix Stacks	145
The Modelview Matrix Stack	148
The Projection Matrix Stack	148
Additional Clipping Planes	149
Examples of Composing Several Transformations	152
Building a Solar System	153
Building an Articulated Robot Arm	156
Reversing or Mimicking Transformations	160
4.	Color	165
Color Perception	166
Computer Color	168
RGBA versus Color-Index Mode	170
RGBA Display Mode	171
Color-Index Display Mode	173
Choosing between RGBA and Color-Index Mode	175
Changing between Display Modes	176
Specifying a Color and a Shading Model	176
Specifying a Color in RGBA Mode	177
Specifying a Color in Color-Index Mode	178
Specifying a Shading Model	179
5.	Lighting	183
A Hidden-Surface Removal Survival Kit	185
Real-World and OpenGL Lighting	187
Ambient, Diffuse, Specular, and Emissive Light	188
Material Colors	189
RGB Values for Lights and Materials	189
A Simple Example: Rendering a Lit Sphere	190
Creating Light Sources	194
Color	196
Position and Attenuation	197
Spotlights	199
Multiple Lights	200
Controlling a Light's Position and Direction	201
Selecting a Lighting Model	207
Global Ambient Light	208
Local or Infinite Viewpoint	209
Two-Sided Lighting	209
Secondary Specular Color	210
Enabling Lighting	211
Defining Material Properties	211
Diffuse and Ambient Reflection	213
Specular Reflection	214
Emission	214
Changing Material Properties	215
Color Material Mode	217
The Mathematics of Lighting	220
Material Emission	221
Scaled Global Ambient Light	222
Contributions from Light Sources	222
Putting It All Together	224
Secondary Specular Color	225
Lighting in Color-Index Mode	226
The Mathematics of Color-Index Mode Lighting	227
6.	Blending, Antialiasing, Fog, and Polygon Offset	229
Blending	231
The Source and Destination Factors	232
Enabling Blending	235
Combining Pixels Using Blending Equations	235
Sample Uses of Blending	238
A Blending Example	240
Three-Dimensional Blending with the Depth Buffer	243
Antialiasing	247
Antialiasing Points or Lines	249
Antialiasing Geometric Primitives with Multisampling	255
Antialiasing Polygons	259
Fog	261
Using Fog	261
Fog Equations	264
Point Parameters	271
Polygon Offset	274
7.	Display Lists	277
Why Use Display Lists?	278
An Example of Using a Display List	279
Display List Design Philosophy	282
Creating and Executing a Display List	285
Naming and Creating a Display List	286
What's Stored in a Display List?	287
Executing a Display List	289
Hierarchical Display Lists	290
Managing Display List Indices	291
Executing Multiple Display Lists	292
Managing State Variables with Display Lists	297
Encapsulating Mode Changes	299
8.	Drawing Pixels, Bitmaps, Fonts, and Images	301
Bitmaps and Fonts	303
The Current Raster Position	305
Drawing the Bitmap	306
Choosing a Color for the Bitmap	308
Fonts and Display Lists	309
Defining and Using a Complete Font	310
Images	312
Reading, Writing, and Copying Pixel Data	313
Imaging Pipeline	321
Pixel Packing and Unpacking	324
Controlling Pixel-Storage Modes	325
Pixel-Transfer Operations	330
Pixel Mapping	333
Magnifying, Reducing, or Flipping an Image	334
Reading and Drawing Pixel Rectangles	337
The Pixel Rectangle Drawing Process	338
Tips for Improving Pixel Drawing Rates	341
Imaging Subset	342
Color Tables	344
Convolutions	349
Color Matrix	357
Histogram	359
Minmax	362
9.	Texture Mapping	365
An Overview and an Example	371
Steps in Texture Mapping	371
A Sample Program	372
Specifying the Texture	375
Texture Proxy	380
Replacing All or Part of a Texture Image	382
One-Dimensional Textures	385
Three-Dimensional Textures	387
Compressed Texture Images	392
Using a Texture's Borders	395
Mipmaps: Multiple Levels of Detail	395
Filtering	406
Texture Objects	409
Naming a Texture Object	410
Creating and Using Texture Objects	410
Cleaning Up Texture Objects	413
A Working Set of Resident Textures	414
Texture Functions	416
Assigning Texture Coordinates	420
Computing Appropriate Texture Coordinates	422
Repeating and Clamping Textures	423
Automatic Texture-Coordinate Generation	429
Creating Contours	430
Sphere Map	434
Cube Map Textures	436
Multitexturing	438
Texture Combiner Functions	444
The Interpolation Combiner Function	448
Applying Secondary Color after Texturing	450
Secondary Color When Lighting Is Disabled	450
Secondary Specular Color When Lighting Is Enabled	450
The Texture Matrix Stack	451
Depth Textures	452
Creating a Shadow Map	453
Generating Texture Coordinates and Rendering	454
10.	The Framebuffer	457
Buffers and Their Uses	460
Color Buffers	461
Clearing Buffers	462
Selecting Color Buffers for Writing and Reading	463
Masking Buffers	465
Testing and Operating on Fragments	467
Scissor Test	468
Alpha Test	468
Stencil Test	470
Depth Test	475
Occlusion Query	476
Blending, Dithering, and Logical Operations	479
The Accumulation Buffer	482
Scene Antialiasing	483
Motion Blur	489
Depth of Field	489
Soft Shadows	494
Jittering	494
11.	Tessellators and Quadrics	497
Polygon Tessellation	498
Creating a Tessellation Object	500
Tessellation Callback Routines	500
Tessellation Properties	505
Polygon Definition	510
Deleting a Tessellation Object	513
Tessellation Performance Tips	513
Describing GLU Errors	514
Backward Compatibility	514
Quadrics: Rendering Spheres, Cylinders, and Disks	515
Managing Quadrics Objects	516
Controlling Quadrics Attributes	517
Quadrics Primitives	519
12.	Evaluators and NURBS	525
Prerequisites	527
Evaluators	528
One-Dimensional Evaluators	528
Two-Dimensional Evaluators	534
Using Evaluators for Textures	540
The GLU NURBS Interface	542
A Simple NURBS Example	542
Managing a NURBS Object	547
Creating a NURBS Curve or Surface	551
Trimming a NURBS Surface 	557
13.	Selection and Feedback	561
Selection	562
The Basic Steps	563
Creating the Name Stack	564
The Hit Record	566
A Selection Example	567
Picking	570
Hints for Writing a Program That Uses Selection	581
Feedback	583
The Feedback Array	585
Using Markers in Feedback Mode	586
A Feedback Example	586
14.	Now That You Know	591
Error Handling	593
Which Version Am I Using?	595
Utility Library Version	596
Window System Extension Versions	597
Extensions to the Standard	597
Extensions to the Standard for Microsoft Windows (WGL)	599
Cheesy Translucency	600
An Easy Fade Effect	600
Object Selection Using the Back Buffer	602
Cheap Image Transformation	603
Displaying Layers	604
Antialiased Characters	605
Drawing Round Points	608
Interpolating Images	608
Making Decals	608
Drawing Filled, Concave Polygons Using the Stencil Buffer	610
Finding Interference Regions	611
Shadows	613
Hidden-Line Removal	614
Hidden-Line Removal with Polygon Offset	614
Hidden-Line Removal with the Stencil Buffer	615
Texture Mapping Applications	616
Drawing Depth-Buffered Images	617
Dirichlet Domains	617
Life in the Stencil Buffer	619
Alternative Uses for glDrawPixels() and glCopyPixels()	620
15.	OpenGL 2.0 and the OpenGL Shading Language	623
Why OpenGL 2.0?	624
Point Sprites	624
The OpenGL Graphics Pipeline and Programmable Shading	626
Vertex Processing	627
Fragment Processing	629
Using GLSL Shaders	630
A Sample Shader	630
OpenGL / GLSL Interface	631
The OpenGL Shading Language	638
Creating Shaders with GLSL	639
The Starting Point	639
Declaring Variables	639
Aggregate Types	641
Statements	648
Functions	651
Using OpenGL State Values in GLSL Programs	653
Accessing Texture Maps in Shaders	653
Vertex Shader Specifics	655
Fragment Shaders	662
A.	Order of Operations	665
Overview	666
Geometric Operations	667
Per-Vertex Operations	667
Primitive Assembly	668
Pixel Operations	668
Texture Memory	669
Fragment Operations	669
Odds and Ends	670
B.	State Variables	671
The Query Commands	672
OpenGL State Variables	674
Current Values and Associated Data	676
Vertex Array	677
Transformation	681
Coloring	683
Lighting	684
Rasterization	686
Multisampling	688
Texturing	689
Pixel Operations	695
Framebuffer Control	697
Pixels	698
Evaluators	704
Hints	705
Implementation-Dependent Values	706
Implementation-Dependent Pixel Depths	710
Miscellaneous 	710
C.	OpenGL and Window Systems	713
Accessing New OpenGL Functions	714
GLX: OpenGL Extension for the X Window System	715
Initialization	716
Controlling Rendering	717
GLX Prototypes	719
AGL: OpenGL Extensions for the Apple Macintosh	722
Initialization	722
Rendering and Contexts	723
Managing an OpenGL Rendering Context	723
On-Screen Rendering	723
Off-Screen Rendering	724
Full-Screen Rendering	724
Swapping Buffers	724
Updating the Rendering Buffers	724
Using an Apple Macintosh Font	724
Error Handling	725
AGL Prototypes	725
PGL: OpenGL Extension for IBM OS/2 Warp	727
Initialization	727
Controlling Rendering	728
PGL Prototypes	729
WGL: OpenGL Extension for Microsoft 
Windows 95/98/NT/ME/2000/XP	731
Initialization	731
Controlling Rendering	732
WGL Prototypes	733
D.	Basics of GLUT: The OpenGL Utility Toolkit	737
Initializing and Creating a Window	738
Handling Window and Input Events	739
Loading the Color Map	741
Initializing and Drawing Three-Dimensional Objects	741
Managing a Background Process	743
Running the Program	743
E.	Calculating Normal Vectors	745
Finding Normals for Analytic Surfaces	747
Finding Normals from Polygonal Data	749
F.	Homogeneous Coordinates and Transformation Matrices	751
Homogeneous Coordinates	752
Transforming Vertices	752
Transforming Normals	753
Transformation Matrices	753
Translation	754
Scaling	754
Rotation	754
Perspective Projection	755
Orthographic Projection	756
G.	Programming Tips	757
OpenGL Correctness Tips	758
OpenGL Performance Tips	760
GLX Tips	762
H.	OpenGL Invariance	763
I.	Built-In OpenGL Shading Language Variables and Functions	767
Variables	768
Vertex Shader Input Attributes Variables	768
Vertex Shader Special Output Variables	768
Vertex Shader Output Varying Variables	769
Built-In Implementation Constants	770
Built-In Uniform State Variables	771
Built-In Functions	780
Angle Conversion and Trigonometric Functions	780
Transcendental Functions	781
Basic Numerical Functions	782
Vector-Operation Functions	783
Matrix Functions	784
Vector-Component Relational Functions	784
Texture Lookup Functions	785
Fragment Processing Functions	790
Noise Functions	790
	Glossary	791
	Index	813

Library of Congress Subject Headings for this publication:

Computer graphics.
OpenGL.