did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780321335739

OpenGL Programming Guide: The Official Guide To Learning OpenGL, Version 2

by ; ; ; ;
  • ISBN13:

    9780321335739

  • ISBN10:

    0321335732

  • Edition: 5th
  • Format: Paperback
  • Copyright: 2006-01-01
  • Publisher: Addison-Wesley Professional
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $59.99

Summary

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 OpenGLreg; Programming Guide, Fifth Edition, provides definitive and comprehensive information on OpenGL and the OpenGL Utility Library. The previous edition covered OpenGL through Version 1.4. This fifth edition of the best-selling "red book" describes the latest features of OpenGL Versions 1.5 and 2.0, including the introduction of the OpenGL Shading Language.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 fifth edition has been extensively updated to include the newest features of OpenGL Versions 1.5 and 2.0, including: Storage of vertex arrays in buffer objects for faster rendering Occlusion queries for course-grain visibility testing Non-power-of-two dimensioned texture maps Point sprites Separate stencil operations for RGB and alpha Rendering to multiple color buffers using GLSL Most importantly, this edition discusses the OpenGL Shading Language (GLSL) and explains the mechanics of using this new language to create complex graphics effects and boost the computational power of OpenGL.

Author Biography

Dave Shreiner is an OpenGL engineer at SGI

Table of 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
Introduction to OpenGL
1(26)
What Is OpenGL?
2(3)
A Smidgen of OpenGL Code
5(2)
OpenGL Command Syntax
7(2)
OpenGL as a State Machine
9(1)
OpenGL Rendering Pipeline
10(4)
Display Lists
11(1)
Evaluators
11(1)
Per-Vertex Operations
12(1)
Primitive Assembly
12(1)
Pixel Operations
12(1)
Texture Assembly
13(1)
Rasterization
13(1)
Fragment Operations
13(1)
OpenGL-Related Libraries
14(6)
Include Files
15(1)
GLUT, the OpenGL Utility Toolkit
16(4)
Animation
20(7)
The Refresh That Pauses
22(1)
Motion = Redraw + Swap
23(4)
State Management and Drawing Geometric Objects
27(76)
A Drawing Survival Kit
29(8)
Clearing the Window
30(2)
Specifying a Color
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)
Specifying Vertices
41(1)
OpenGL Geometric Drawing Primitives
42(6)
Basic State Management
48(2)
Displaying Points, Lines, and Polygons
50(13)
Point Details
50(1)
Line Details
51(4)
Polygon Details
55(8)
Normal Vectors
63(2)
Vertex Arrays
65(17)
Step 1: Enabling Arrays
67(1)
Step 2: Specifying Data for the Arrays
68(3)
Step 3: Dereferencing and Rendering
71(7)
Interleaved Arrays
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)
Attribute Groups
90(3)
Some Hints for Building Polygonal Models of Surfaces
93(10)
An Example: Building an Icosahedron
95(8)
Viewing
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)
Modeling Transformations
120(6)
Viewing Transformations
126(7)
Projection Transformations
133(5)
Perspective Projection
133(3)
Orthographic Projection
136(2)
Viewing Volume Clipping
138(1)
Viewport Transformation
138(4)
Defining the Viewport
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)
Building a Solar System
153(3)
Building an Articulated Robot Arm
156(4)
Reversing or Mimicking Transformations
160(5)
Color
165(18)
Color Perception
166(2)
Computer Color
168(2)
RGBA versus Color-Index Mode
170(6)
RGBA Display Mode
171(2)
Color-Index Display Mode
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)
Lighting
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)
Material Colors
189(1)
RGB Values for Lights and Materials
189(1)
A Simple Example: Rendering a Lit Sphere
190(4)
Creating Light Sources
194(13)
Color
196(1)
Position and Attenuation
197(2)
Spotlights
199(1)
Multiple Lights
200(1)
Controlling a Light's Position and Direction
201(6)
Selecting a Lighting Model
207(4)
Global Ambient Light
208(1)
Local or Infinite Viewpoint
209(1)
Two-Sided Lighting
209(1)
Secondary Specular Color
210(1)
Enabling Lighting
211(1)
Defining Material Properties
211(9)
Diffuse and Ambient Reflection
213(1)
Specular Reflection
214(1)
Emission
214(1)
Changing Material Properties
215(2)
Color Material Mode
217(3)
The Mathematics of Lighting
220(6)
Material Emission
221(1)
Scaled Global Ambient Light
222(1)
Contributions from Light Sources
222(2)
Putting It All Together
224(1)
Secondary Specular Color
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)
Blending
231(16)
The Source and Destination Factors
232(3)
Enabling Blending
235(1)
Combining Pixels Using Blending Equations
235(3)
Sample Uses of Blending
238(2)
A Blending Example
240(3)
Three-Dimensional Blending with the Depth Buffer
243(4)
Antialiasing
247(14)
Antialiasing Points or Lines
249(6)
Antialiasing Geometric Primitives with Multisampling
255(4)
Antialiasing Polygons
259(2)
Fog
261(10)
Using Fog
261(3)
Fog Equations
264(7)
Point Parameters
271(3)
Polygon Offset
274(3)
Display Lists
277(24)
Why Use Display Lists?
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)
Executing a Display List
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)
Bitmaps and Fonts
303(9)
The Current Raster Position
305(1)
Drawing the Bitmap
306(2)
Choosing a Color for the Bitmap
308(1)
Fonts and Display Lists
309(1)
Defining and Using a Complete Font
310(2)
Images
312(9)
Reading, Writing, and Copying Pixel Data
313(8)
Imaging Pipeline
321(16)
Pixel Packing and Unpacking
324(1)
Controlling Pixel-Storage Modes
325(5)
Pixel-Transfer Operations
330(3)
Pixel Mapping
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)
Imaging Subset
342(23)
Color Tables
344(5)
Convolutions
349(8)
Color Matrix
357(2)
Histogram
359(3)
Minmax
362(3)
Texture Mapping
365(92)
An Overview and an Example
371(4)
Steps in Texture Mapping
371(1)
A Sample Program
372(3)
Specifying the Texture
375(31)
Texture Proxy
380(2)
Replacing All or Part of a Texture Image
382(3)
One-Dimensional Textures
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)
Filtering
406(3)
Texture Objects
409(7)
Naming a Texture Object
410(1)
Creating and Using Texture Objects
410(3)
Cleaning Up Texture Objects
413(1)
A Working Set of Resident Textures
414(2)
Texture Functions
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)
Creating Contours
430(4)
Sphere Map
434(2)
Cube Map Textures
436(2)
Multitexturing
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)
The Texture Matrix Stack
451(1)
Depth Textures
452(5)
Creating a Shadow Map
453(1)
Generating Texture Coordinates and Rendering
454(3)
The Framebuffer
457(40)
Buffers and Their Uses
460(7)
Color Buffers
461(1)
Clearing Buffers
462(1)
Selecting Color Buffers for Writing and Reading
463(2)
Masking Buffers
465(2)
Testing and Operating on Fragments
467(15)
Scissor Test
468(1)
Alpha Test
468(2)
Stencil Test
470(5)
Depth Test
475(1)
Occlusion Query
476(3)
Blending, Dithering, and Logical Operations
479(3)
The Accumulation Buffer
482(15)
Scene Antialiasing
483(6)
Motion Blur
489(1)
Depth of Field
489(5)
Soft Shadows
494(1)
Jittering
494(3)
Tessellators and Quadrics
497(28)
Polygon Tessellation
498(17)
Creating a Tessellation Object
500(1)
Tessellation Callback Routines
500(5)
Tessellation Properties
505(5)
Polygon Definition
510(3)
Deleting a Tessellation Object
513(1)
Tessellation Performance Tips
513(1)
Describing GLU Errors
514(1)
Backward Compatibility
514(1)
Quadrics: Rendering Spheres, Cylinders, and Disks
515(10)
Managing Quadrics Objects
516(1)
Controlling Quadrics Attributes
517(2)
Quadrics Primitives
519(6)
Evaluators and NURBS
525(36)
Prerequisites
527(1)
Evaluators
528(14)
One-Dimensional Evaluators
528(6)
Two-Dimensional Evaluators
534(6)
Using Evaluators for Textures
540(2)
The GLU NURBS Interface
542(19)
A Simple NURBS Example
542(5)
Managing a NURBS Object
547(4)
Creating a NURBS Curve or Surface
551(6)
Trimming a NURBS Surface
557(4)
Selection and Feedback
561(30)
Selection
562(21)
The Basic Steps
563(1)
Creating the Name Stack
564(2)
The Hit Record
566(1)
A Selection Example
567(3)
Picking
570(11)
Hints for Writing a Program That Uses Selection
581(2)
Feedback
583(8)
The Feedback Array
585(1)
Using Markers in Feedback Mode
586(1)
A Feedback Example
586(5)
Now That You Know
591(32)
Error Handling
593(2)
Which Version Am I Using?
595(2)
Utility Library Version
596(1)
Window System Extension Versions
597(1)
Extensions to the Standard
597(3)
Extensions to the Standard for Microsoft Windows (WGL)
599(1)
Cheesy Translucency
600(1)
An Easy Fade Effect
600(2)
Object Selection Using the Back Buffer
602(1)
Cheap Image Transformation
603(1)
Displaying Layers
604(1)
Antialiased Characters
605(3)
Drawing Round Points
608(1)
Interpolating Images
608(1)
Making Decals
608(2)
Drawing Filled, Concave Polygons Using the Stencil Buffer
610(1)
Finding Interference Regions
611(2)
Shadows
613(1)
Hidden-Line Removal
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)
Dirichlet Domains
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)
Why OpenGL 2.0?
624(1)
Point Sprites
624(2)
The OpenGL Graphics Pipeline and Programmable Shading
626(4)
Vertex Processing
627(2)
Fragment Processing
629(1)
Using GLSL Shaders
630(8)
A Sample Shader
630(1)
OpenGL/GLSL Interface
631(7)
The OpenGL Shading Language
638(1)
Creating Shaders with GLSL
639(14)
The Starting Point
639(1)
Declaring Variables
639(2)
Aggregate Types
641(7)
Statements
648(3)
Functions
651(2)
Using OpenGL State Values in GLSL Programs
653(1)
Accessing Texture Maps in Shaders
653(12)
Vertex Shader Specifics
655(7)
Fragment Shaders
662(3)
A. Order of Operations
665(6)
Overview
666(1)
Geometric Operations
667(1)
Per-Vertex Operations
667(1)
Primitive Assembly
668(1)
Pixel Operations
668(1)
Texture Memory
669(1)
Fragment Operations
669(1)
Odds and Ends
670(1)
B. State Variables
671(42)
The Query Commands
672(2)
OpenGL State Variables
674(39)
Current Values and Associated Data
676(1)
Vertex Array
677(4)
Transformation
681(2)
Coloring
683(1)
Lighting
684(2)
Rasterization
686(2)
Multisampling
688(1)
Texturing
689(6)
Pixel Operations
695(2)
Framebuffer Control
697(1)
Pixels
698(6)
Evaluators
704(1)
Hints
705(1)
Implementation-Dependent Values
706(4)
Implementation-Dependent Pixel Depths
710(1)
Miscellaneous
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)
Initialization
716(1)
Controlling Rendering
717(2)
GLX Prototypes
719(3)
AGL: OpenGL Extensions for the Apple Macintosh
722(5)
Initialization
722(1)
Rendering and Contexts
723(1)
Managing an OpenGL Rendering Context
723(1)
On-Screen Rendering
723(1)
Off-Screen Rendering
724(1)
Full-Screen Rendering
724(1)
Swapping Buffers
724(1)
Updating the Rendering Buffers
724(1)
Using an Apple Macintosh Font
724(1)
Error Handling
725(1)
AGL Prototypes
725(2)
PGL: OpenGL Extension for IBM OS/2 Warp
727(4)
Initialization
727(1)
Controlling Rendering
728(1)
PGL Prototypes
729(2)
WGL: OpenGL Extension for Microsoft Windows 95/98/NT/ME/2000/XP
731(6)
Initialization
731(1)
Controlling Rendering
732(1)
WGL Prototypes
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)
Loading the Color Map
741(1)
Initializing and Drawing Three-Dimensional Objects
741(2)
Managing a Background Process
743(1)
Running the Program
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)
Homogeneous Coordinates
752(1)
Transforming Vertices
752(1)
Transforming Normals
753(1)
Transformation Matrices
753(4)
Translation
754(1)
Scaling
754(1)
Rotation
754(1)
Perspective Projection
755(1)
Orthographic Projection
756(1)
G. Programming Tips
757(6)
OpenGL Correctness Tips
758(2)
OpenGL Performance Tips
760(2)
GLX Tips
762(1)
H. OpenGL Invariance
763(4)
I. Built-in OpenGL Shading Language Variables and Functions
767(24)
Variables
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)
Built-In Functions
780(11)
Angle Conversion and Trigonometric Functions
780(1)
Transcendental Functions
781(1)
Basic Numerical Functions
782(1)
Vector-Operation Functions
783(1)
Matrix Functions
784(1)
Vector-Component Relational Functions
784(1)
Texture Lookup Functions
785(5)
Fragment Processing Functions
790(1)
Noise Functions
790(1)
Glossary 791(22)
Index 813

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Excerpts

The OpenGL graphics system is a software interface to graphics hardware. (The GL stands for Graphics Library.) It allows you to create interactive programs that produce color images of moving three-dimensional objects. With OpenGL, you can control computer-graphics technology to produce realistic pictures or ones that depart from reality in imaginative ways. This guide explains how to program with the OpenGL graphics system to deliver the visual effect you want. What This Guide Contains This guide has 15 chapters. The first five chapters present basic information that you need to understand to be able to draw a properly colored and lit three-dimensional object on the screen. Chapter 1,"Introduction to OpenGL,"provides a glimpse into the kinds of things OpenGL can do. It also presents a simple OpenGL program and explains essential programming details you need to know for subsequent chapters. Chapter 2,"State Management and Drawing Geometric Objects,"explains how to create a three-dimensional geometric description of an object that is eventually drawn on the screen. Chapter 3,"Viewing,"describes how such three-dimensional models are transformed before being drawn on a two-dimensional screen. You can control these transformations to show a particular view of a model. Chapter 4,"Color,"describes how to specify the color and shading method used to draw an object. Chapter 5,"Lighting,"explains how to control the lighting conditions surrounding an object and how that object responds to light (that is, how it reflects or absorbs light). Lighting is an important topic, since objects usually don't look three-dimensional until they're lit. The remaining chapters explain how to optimize or add sophisticated features to your three-dimensional scene. You might choose not to take advantage of many of these features until you're more comfortable with OpenGL. Particularly advanced topics are noted in the text where they occur. Chapter 6,"Blending, Antialiasing, Fog, and Polygon Offset,"describes techniques essential to creating a realistic scene--alpha blending (to create transparent objects), antialiasing (to eliminate jagged edges), atmospheric effects (to simulate fog or smog), and polygon offset (to remove visual artifacts when highlighting the edges of filled polygons). Chapter 7,"Display Lists,"discusses how to store a series of OpenGL commands for execution at a later time. You'll want to use this feature to increase the performance of your OpenGL program. Chapter 8,"Drawing Pixels, Bitmaps, Fonts, and Images,"discusses how to work with sets of two-dimensional data as bitmaps or images. One typical use for bitmaps is describing characters in fonts. Chapter 9,"Texture Mapping,"explains how to map one-, two-, and three-dimensional images calledtexturesonto three-dimensional objects. Many marvelous effects can be achieved through texture mapping. Chapter 10,"The Framebuffer,"describes all the possible buffers that can exist in an OpenGL implementation and how you can control them. You can use the buffers for such effects as hidden-surface elimination, stenciling, masking, motion blur, and depth-of-field focusing. Chapter 11,"Tessellators and Quadrics,"shows how to use the tessellation and quadrics routines in the GLU (OpenGL Utility Library). Chapter 12,"Evaluators and NURBS,"gives an introduction to advanced techniques for efficient generation of curves or surfaces. Chapter 13,"Selection

Rewards Program