Rough Cuts are manuscripts that are developed but not yet published, available through Safari. Rough Cuts provide you access to the very latest information on a given topic and offer you the opportunity to interact with the author to influence the final publication.
This is a working draft of a pre-release book. It is available before the published date as part of the Rough Cuts service.
OpenGL is a powerful software interface used to produce high-quality, computer-generated images and interactive applications using 2D and 3D objects, bitmaps, and color images.
The OpenGL®Programming Guide, Seventh Edition, provides definitive and comprehensive information on OpenGL and the OpenGL Utility Library. The previous edition covered OpenGL through Version 2.1. This seventh edition of the best-selling “red book” describes the latest features of OpenGL Versions 3.0 and 3.1. You will find clear explanations of OpenGL functionality and many basic computer graphics techniques, such as building and rendering 3D models; interactively viewing objects from different perspective points; and using shading, lighting, and texturing effects for greater realism. In addition, this book provides in-depth coverage of advanced techniques, including texture mapping, antialiasing, fog and atmospheric effects, NURBS, image processing, and more. The text also explores other key topics such as enhancing performance, OpenGL extensions, and cross-platform techniques.
This seventh edition has been updated to include the newest features of OpenGL Versions 3.0 and 3.1, including
This edition continues the discussion of the OpenGL Shading Language (GLSL) and explains the mechanics of using this language to create complex graphics effects and boost the computational power of OpenGL. The OpenGL Technical Library provides tutorial and reference books for OpenGL. The Library enables programmers to gain a practical understanding of OpenGL and shows them how to unlock its full potential. Originally developed by SGI, the Library continues to evolve under the auspices of the Khronos OpenGL ARB Working Group, an industry consortium responsible for guiding the evolution of OpenGL and related technologies.
Figures xxi
Tables xxv
Examples xxix
About This Guide xxxv
Acknowledgments xlv
Chapter 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
OpenGL-Related Libraries 14
Animation 22
OpenGL and Its Deprecation Mechanism 27
Chapter 2: State Management and Drawing Geometric Objects 31
A Drawing Survival Kit 34
Describing Points, Lines, and Polygons 42
Basic State Management 53
Displaying Points, Lines, and Polygons 55
Normal Vectors 68
Vertex Arrays 70
Buffer Objects 91
Vertex-Array Objects 104
Attribute Groups 110
Some Hints for Building Polygonal Models of Surfaces 113
Chapter 3: Viewing 123
Overview: The Camera Analogy 126
Viewing and Modeling Transformations 137
Projection Transformations 152
Viewport Transformation 158
Troubleshooting Transformations 162
Manipulating the Matrix Stacks 164
Additional Clipping Planes 168
Examples of Composing Several Transformations 172
Reversing or Mimicking Transformations 179
Chapter 4: Color 185
Color Perception 186
Computer Color 188
RGBA versus Color-Index Mode 190
Specifying a Color and a Shading Model 196
Chapter 5: Lighting 203
A Hidden-Surface Removal Survival Kit 205
Real-World and OpenGL Lighting 207
A Simple Example: Rendering a Lit Sphere 210
Creating Light Sources 214
Selecting a Lighting Model 227
Defining Material Properties 231
The Mathematics of Lighting 240
Lighting in Color-Index Mode 246
Chapter 6: Blending, Antialiasing, Fog, and Polygon Offset 249
Blending 251
Antialiasing 267
Fog 280
Point Parameters 291
Polygon Offset 293
Chapter 7: Display Lists 297
Why Use Display Lists? 298
An Example of Using a Display List 299
Display List Design Philosophy 302
Creating and Executing a Display List 305
Executing Multiple Display Lists 312
Managing State Variables with Display Lists 318
&nbs