- Copyright 2008
- Edition: 6th
-
Book
- ISBN-10: 0-321-48100-3
- ISBN-13: 978-0-321-48100-9
OpenGL® Programming Guide, Sixth Edition
OpenGL is a powerful software interface used to produce high-quality, computergenerated images and interactive applications using 2D and 3D objects, bitmaps, and color images.
The OpenGL® Programming Guide, Sixth Edition, provides definitive and comprehensive information on OpenGL and the OpenGL Utility Library. The previous edition covered OpenGL through Version 2.0. This sixth edition of the best-selling "red book" describes the latest features of OpenGL Version 2.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 sixth edition has been updated to include the newest features of OpenGL Version 2.1, including:
- Using server-side pixel buffer objects for fast pixel rectangle download and retrieval
- Discussion of the sRGB texture format
- Expanded discussion of the OpenGL Shading Language
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 OpenGL Architecture Review Board (ARB) Steering Group (now part of the Khronos Group), an industry consortium responsible for guiding the evolution of OpenGL and related technologies.
Downloadable Sample Chapter
Chapter 9: Texture Mapping
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 xxxix
Nate Robins' OpenGL Tutors xl
Errata xl
Style Conventions xl
Acknowledgments xliii
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 20
Chapter 2: State Management and Drawing Geometric Objects 27
- A Drawing Survival Kit 29
Describing Points, Lines, and Polygons 37
Basic State Management 48
Displaying Points, Lines, and Polygons 50
Normal Vectors 63
Vertex Arrays 65
Buffer Objects 82
Attribute Groups 91
Some Hints for Building Polygonal Models of Surfaces 94
Chpater 3: Viewing 103
- Overview: The Camera Analogy 106
Viewing and Modeling Transformations 117
Projection Transformations 133
Viewport Transformation 138
Troubleshooting Transformations 142
Manipulating the Matrix Stacks 145
Additional Clipping Planesv 149
Examples of Composing Several Transformations 152
Reversing or Mimicking Transformations 160
Chapter 4: Color 165
- Color Perception 166
Computer Color 168
RGBA versus Color-Index Mode 170
Specifying a Color and a Shading Model 176
Chapter 5: Lighting 183
- A Hidden-Surface Removal Survival Kit 185
Real-World and OpenGL Lighting 187
A Simple Example: Rendering a Lit Sphere 190
Creating Light Sources 194
Selecting a Lighting Model 207
Defining Material Properties 211
The Mathematics of Lighting 220
Lighting in Color-Index Mode 226
Chapter 6: Blending, Antialiasing, Fog, and Polygon Offset 229
- Blending 231
Antialiasing 247
Fogv 261
Point Parameters 271
Polygon Offset v274
Chapter 7: Display Lists 277
- Why Use Display Lists? 278
An Example of Using a Display List 279
Display List Design Philosophy v282
Creating and Executing a Display List 285
Executing Multiple Display v292
Managing State Variables with Display Lists 297
Chapter 8: Drawing Pixels, Bitmaps, Fonts, and Images 301
- Bitmaps and Fonts 303
Images 312
Imaging Pipeline 321
Reading and Drawing Pixel Rectangles 337
Using Buffer Objects with Pixel Rectangle Data 341
Tips for Improving Pixel Drawing Rates 345
Imaging Subsetv 346
Chapter 9: Texture Mapping 369
- An Overview and an Example 375
Specifying the Texture 380
Filtering 411
Texture Objects 414
Texture Functions 421
Assigning Texture Coordinates 425
Automatic Texture-Coordinate Generation 434
Multitexturing 443
Texture Combiner Functions 449
Applying Secondary Color after Texturing 455
Sprites 456
The Texture Matrix Stack 457
Depth Textures 459
Chapter 10: The Framebuffer 465
- Buffers and Their Uses 468
Testing and Operating on Fragments 475
The Accumulation Bufferv 490
Chapter 11: Tessellators and Quadrics 505
- Polygon Tessellation 506
Quadrics: Rendering Spheres, Cylinders, and Disks 523
Chapter 12: Evaluators and NURBS 533
- Prerequisites 535
Evaluatorsv 536
The GLU NURBS Interface 550
Chapter 13: Selection and Feedback 569
- Selection 570Feedbackv 591
Chapter 14: Now That You Knowv 599
- Error Handling 601
Which Version Am I Using? 603
Extensions to the Standard 605
Cheesy Translucency 608
An Easy Fade Effect 608
Object Selection Using the Back Buffer 610
Cheap Image Transformation 611
Displaying Layers 612
Antialiased Characters 613
Drawing Round Points 616
Interpolating Images 616
Making Decals 616
Drawing Filled, Concave Polygons Using the Stencil Buffer 618
Finding Interference Regions 619
Shadows 621
Hidden-Line Removal 622
Texture Mapping Applications 624
Drawing Depth-Buffered Images 625
Dirichlet Domains 625
Life in the Stencil Buffer 627
Alternative Uses for glDrawPixels() and glCopyPixels() 628
Chapter 15: The OpenGL Shading Language 631
- The OpenGL Graphics Pipeline and Programmable Shading 632
Using GLSL Shaders 636
The OpenGL Shading Language 644
Creating Shaders with GLSL 645
Accessing Texture Maps in Shaders 661
Shader Preprocessor 664
Appendix A: Order of Operations 679
- Overview 680
Geometric Operations 681
Pixel Operations 682
Fragment Operations 683Odds and Ends 684
Appendix B: State Variables 685
- The Query Commands 686
OpenGL State Variables 688
Appendix C: OpenGL and Window Systems 735
- Accessing New OpenGL Functions 736
GLX: OpenGL Extension for the X Window System 737
AGL: OpenGL Extensions for the Apple Macintosh 744
PGL: OpenGL Extension for IBM OS/2 Warp 749
WGL: OpenGL Extension for Microsoft Windows 95/98/NT/ME/2000/XP 753
Appendix D: Basics of GLUT: The OpenGL Utility Toolkit 759
- Initializing and Creating a Window 760
Handling Window and Input Events 761
Loading the Color Map 763
Initializing and Drawing Three-Dimensional Objects 763
Managing a Background Process 765
Running the Program 765
Appendix E: Calculating Normal Vectors 767
- Finding Normals for Analytic Surfaces 769
Finding Normals from Polygonal Data 771
Appendix F: Homogeneous Coordinates and Transformation Matrices 773
- Homogeneous Coordinates 774
Transformation Matrices 775
Appendix G: Programming Tips 779
- OpenGL Correctness Tips 780
OpenGL Performance Tips 782
GLX Tips 784
Appendix H: OpenGL Invariance 785
Appendix I: Built-In OpenGL Shading Language Variables and Functions 789
- Variables 790
Built-In Functions 802
Glossary 815
Index 837
Preface
Preface
Index
Index