OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 2.1, 6/e

OpenGL Architecture Review Board, Dave Shreiner, Mason Woo, Jackie Neider, Tom Davis

  • 出版商: Addison Wesley
  • 出版日期: 2007-08-09
  • 售價: $2,630
  • 貴賓價: 9.5$2,499
  • 語言: 英文
  • 頁數: 928
  • 裝訂: Paperback
  • ISBN: 0321481003
  • ISBN-13: 9780321481009
  • 相關分類: OpenGL
  • 已過版

買這商品的人也買了...

商品描述

Description

The Macintosh has fully embraced OpenGL throughout its visual systems. In fact, Apple's highly efficient, modern OpenGL implementation makes Mac OS X one of today's best platforms for OpenGL development. OpenGL® Programming on Mac OS® X is the first comprehensive resource for every graphics programmer who wants to create, port, or optimize OpenGL applications for this high-volume platform.

Leading OpenGL experts Bob Kuehne and J. D. Sullivan thoroughly explain the Macintosh's diverse OpenGL APIs, both old and new. They illuminate crucial OpenGL setup, configuration, and performance issues that are unique to the Macintosh platform. Next, they offer practical, start-to-finish guidance for integrating key Mac-native APIs with OpenGL, and leveraging the full power of the Macintosh platform in your graphics applications. Coverage includes

  • A thorough review of the Macintosh's hardware and software architectures and their performance implications
  • In-depth, expert guidance for accessing OpenGL from each of the Mac's core APIs: CGL, AGL, and Cocoa
  • Interoperating with other Mac APIs: incorporating video with QuickTime, performing image effects with Core Image, and processing CoreVideo data
  • Analyzing Mac OpenGL application performance, resolving bottlenecks, and leveraging optimizations only available on the Mac
  • Detecting, integrating, and using OpenGL extensions

An accompanying Web site contains all example code, plus additional OpenGL-related resources.

This book will be especially valuable to current Macintosh programmers seeking to leverage OpenGL's power; all OpenGL developers porting their applications to the high-volume Mac platform; and cross-platform graphics developers who want to access more of the Mac platform's native power

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