Books for the Mobile Developer Community
Books
OpenGL(r) ES 2.0 Programming Guide
In the OpenGL(r) ES 2.0 Programming Guide, three leading authorities on the Open GL ES 2.0 interface-including the specification’s editor-provide start-to-finish guidance for maximizing the interface’s value in a wide range of high-performance applications. The authors cover the entire API, including Khronos-ratified extensions. Using detailed C-based code examples, they demonstrate how to set up and program every aspect of the graphics pipeline. You’ll move from introductory techniques all the way to advanced per-pixel lighting, particle systems, and performance optimization.
Author Bios
Aaftab Munshi has been architecting GPUs for more than a decade. At ATI (now AMD), he was a Senior Architect in the Handheld Group. He is the spec editor for the OpenGL ES 1.1 and OpenGL ES 2.0 specifications. Affie currently works at Apple.
Dan Ginsburg has been working on video games and computer graphics for more than ten years. Dan is currently a Senior Member of Technical Staff at AMD. He has worked in a variety of roles at AMD, including the development of OpenGL drivers, the creation of desktop and handheld 3D demos, and currently leading the development of handheld GPU developer tools. Before joining AMD, Dan worked for n-Space, Inc., an Orlando-based game development company. He holds a B.S. in Computer Science from Worcester Polytechnic Institute and an M.B.A from Bentley College.
Dave Shreiner has been working with OpenGL for almost two decades, and more recently with OpenGL ES. During that time, he authored the first commercial training course on OpenGL while working at Silicon Graphics Computer Systems (SGI), and has worked as an author on the OpenGL Programming Guide. He's presented introductory and advanced courses on OpenGL programming worldwide at numerous conferences, including SIGGRAPH. Dave is now a Media Systems Architect at ARM, Inc. He holds a B.S. in Mathematics from the University of Delaware.
Table of Contents
- List of Figures
- List of Examples
- List of Tables
- Foreword
- Preface
- Acknowledgments
- About the Authors
Chapter 1. Introduction to OpenGL ES 2.0 1
- What Is OpenGL ES?
- OpenGL ES 2.0
- Vertex Shader
- Primitive Assembly
- Rasterization
- Fragment Shader
- Per-Fragment Operations
- OpenGL ES 2.0 and OpenGL ES 1.x Backward Compatibility
- EGL
- Programming with OpenGL ES 2.0
- Further Reading
Chapter 2. Hello Triangle: An OpenGL ES 2.0 Example 19
- Code Framework
- Where to Download the Examples
- Hello Triangle Example
- Building and Running the Examples
- Using the OpenGL ES 2.0 Framework
- Creating a Simple Vertex and Fragment Shader
- Compiling and Loading the Shaders
- Creating a Program Object and Linking the Shaders
- Setting the Viewport and Clearing the Color Buffer
- Loading the Geometry and Drawing a Primitive
- Displaying the Back Buffer
Chapter 3. An Introduction to EGL 35
- Communicating with the Windowing System
- Checking for Errors
- Initializing EGL
- Determining the Available Surface Configurations
- Querying EGLConfig Attributes
- Letting EGL Choose the Config
- Creating an On-Screen Rendering Area: The EGL Window
- Creating an Off-Screen Rendering Area: EGL Pbuffers
- Creating a Rendering Context
- Making an EGLContext Current
- Putting All Our EGL Knowledge Together
- Synchronizing Rendering
Chapter 4. Shaders and Programs 57
- Shaders and Programs
- Uniforms and Attributes
- Shader Compiler and Shader Binaries
Chapter 5. OpenGL ES Shading Language 77
- OpenGL ES Shading Language Basics
- Variables and Variable Types
- Variable Constructors
- Vector and Matrix Components
- Constants
- Structures
- Arrays
- Operators
- Functions
- Built-In Functions
- Control Flow Statements
- Uniforms
- Attributes
- Varyings
- Preprocessor and Directives
- Uniform and Varying Packing
- Precision Qualifiers
- Invariance
Chapter 6. Vertex Attributes, Vertex Arrays, and Buffer Objects 101
- Specifying Vertex Attribute Data
- Declaring Vertex Attribute Variables in a Vertex Shader
- Vertex Buffer Objects
- Mapping Buffer Objects
Chapter 7. Primitive Assembly and Rasterization 127
- Primitives
- Drawing Primitives
- Primitive Assembly
- Rasterization
Chapter 8. Vertex Shaders 147
- Vertex Shader Overview
- Vertex Shader Examples
- Generating Texture Coordinates
- Vertex Skinning
- OpenGL ES 1.1 Vertex Pipeline as an ES 2.0 Vertex Shader
Chapter 9. Texturing 181
- Texturing Basics
- Compressed Textures
- Texture Subimage Specification
- Copying Texture Data from the Color Buffer
- Optional Extensions
Chapter 10. Fragment Shaders 215
- Fixed Function Fragment Shaders
- Fragment Shader Overview
- Implementing Fixed Function Techniques Using Shaders
Chapter 11. Fragment Operations 233
- Buffers
- Fragment Tests and Operations
- Blending
- Dithering
- Multisampled Antialiasing
- Reading and Writing Pixels to the Framebuffer
Chapter 12. Framebuffer Objects 253
- Why Framebuffer Objects
- Framebuffer and Renderbuffer Objects
- Creating Framebuffer and Renderbuffer Objects
- Using Renderbuffer Objects
- Using Framebuffer Objects
- Deleting Framebuffer and Renderbuffer Objects
- Examples
- Performance Tips and Tricks
Chapter 13. Advanced Programming with OpenGL ES 2.0 279
- Per-Fragment Lighting
- Environment Mapping
- Particle System with Point Sprites
- Image Postprocessing
- Projective Texturing
- Noise Using a 3D Texture
- Procedural Texturing
Chapter 14. State Queries 323
- OpenGL ES 2.0 Implementation String Queries
- Querying Implementation-Dependent Limits
- Querying OpenGL ES State
- Hints
- Entity Name Queries
- Nonprogrammable Operations Control and Queries
- Shader and Program State Queries
- Vertex Attribute Queries
- Texture State Queries
- Vertex Buffer Queries
- Renderbuffer and Framebuffer State Queries
Chapter 15. OpenGL ES and EGL on Handheld Platforms 339
- Handheld Platforms Overview
- C++ Portability
- OpenKODE
- Platform-Specific Shader Binaries
- Targeting Extensions
Appendix A. GL_HALF_FLOAT_OES 353
- 16-Bit Floating-Point Number
- Converting Float to Half-Float
Appendix B. Built-In Functions 357
- Angle and Trigonometry Functions
- Exponential Functions
- Common Functions
- Geometric Functions
- Matrix Functions
- Vector Relational Functions
- Texture Lookup Functions
- Derivative Functions
Appendix C. Shading Language Grammar 375
Appendix D. ES Framework API 385
- Framework Core Functions
- Transformation Functions





