OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition
Read it now on the O’Reilly learning platform with a 10-day free trial.
O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.
Book description
Includes Complete Coverage of the OpenGL® Shading Language!
Today’s OpenGL software interface enables programmers to produce extraordinarily high-quality computer-generated images and interactive applications using 2D and 3D objects, color images, and programmable shaders.
OpenGL® Programming Guide: The Official Guide to Learning OpenGL®, Version 4.3, Eighth Edition, has been almost completely rewritten and provides definitive, comprehensive information on OpenGL and the OpenGL Shading Language. This edition of the best-selling “Red Book” describes the features through OpenGL version 4.3. It also includes updated information and techniques formerly covered in OpenGL® Shading Language (the “Orange Book”).
For the first time, this guide completely integrates shader techniques, alongside classic, functioncentric techniques. Extensive new text and code are presented, demonstrating the latest in OpenGL programming techniques.
OpenGL® Programming Guide, Eighth Edition, provides clear explanations of OpenGL functionality and techniques, including processing geometric objects with vertex, tessellation, and geometry shaders using geometric transformations and viewing matrices; working with pixels and texture maps through fragment shaders; and advanced data techniques using framebuffer objects and compute shaders.
New OpenGL features covered in this edition include
Show and hide more
Table of contents Product information
Table of contents
- Title Page
- Copyright Page
- Praise for OpenGL® Programming Guide, Eighth Edition
- Dedication Page
- Contents
- Figures
- Tables
- Examples
- About This Guide
- What This Guide Contains
- What’s New in This Edition
- What You Should Know Before Reading This Guide
- How to Obtain the Sample Code
- Errata
- Style Conventions
- What Is OpenGL?
- Your First Look at an OpenGL Program
- OpenGL Syntax
- OpenGL’s Rendering Pipeline
- Preparing to Send Data to OpenGL
- Sending Data to OpenGL
- Vertex Shading
- Tessellation Shading
- Geometry Shading
- Primitive Assembly
- Clipping
- Rasterization
- Fragment Shading
- Per-Fragment Operations
- Entering main()
- OpenGL Initialization
- Our First OpenGL Rendering
- Shaders and OpenGL
- OpenGL’s Programmable Pipeline
- An Overview of the OpenGL Shading Language
- Creating Shaders with GLSL
- Storage Qualifiers
- Statements
- Computational Invariance
- Shader Preprocessor
- Compiler Control
- Global Shader-Compilation Option
- Uniform Blocks
- Specifying Uniform Blocks in Shaders
- Accessing Uniform Blocks from Your Application
- Buffer Blocks
- In/Out Blocks
- Our LoadShaders() Function
- Advanced
- GLSL Subroutine Setup
- Selecting Shader Subroutines
- Advanced
- OpenGL Graphics Primitives
- Points
- Lines, Strips, and Loops
- Triangles, Strips, and Fans
- Creating and Allocating Buffers
- Getting Data into and out of Buffers
- Accessing the Content of Buffers
- Discarding Buffer Data
- VertexAttribPointer in Depth
- Static Vertex-Attribute Specification
- OpenGL Drawing Exercises
- Restarting Primitives
- Instanced Vertex Attributes
- Using the Instance Counter in Shaders
- Instancing Redux
- Basic Color Theory
- Buffers and Their Uses
- Color Buffers
- Depth Buffer
- Stencil Buffer
- Clearing Buffers
- Masking Buffers
- Color Representation and OpenGL
- Vertex Colors
- Rasterization
- Sample Shading
- Scissor Test
- Multisample Fragment Operations
- Stencil Test
- Stencil Examples
- Depth Test
- Blending
- Blending Factors
- Controlling Blending Factors
- The Blending Equation
- Dithering
- Logical Operations
- Occlusion Query
- Conditional Rendering
- Antialiasing Lines
- Antialiasing Polygons
- Advanced
- Renderbuffers
- Creating Renderbuffer Storage
- Framebuffer Attachments
- Framebuffer Completeness
- Invalidating Framebuffers
- Advanced
- Selecting Color Buffers for Writing and Reading
- Dual-Source Blending
- Clamping Returned Values
- Viewing
- Viewing Model
- Camera Model
- Orthographic Viewing Model
- Matrix Multiply Refresher
- Homogeneous Coordinates
- Linear Transformations and Matrices
- Transforming Normals
- OpenGL Matrices
- Viewport
- Multiple Viewports
- Advanced: z Precision
- Advanced: User Clipping
- Transform Feedback Objects
- Transform Feedback Buffers
- Configuring Transform Feedback Varyings
- Starting and Stopping Transform Feedback
- Transform Feedback Example—Particle System
- Texture Mapping
- Basic Texture Types
- Creating and Initializing Textures
- Texture Formats
- Explicitly Setting Texture Data
- Using Pixel Unpack Buffers
- Copying Data from the Framebuffer
- Loading Images from Files
- Retrieving Texture Data
- Texture Data Layout
- Sampler Parameters
- Texture Coordinates
- Arranging Texture Data
- Using Multiple Textures
- 3D Textures
- Array Textures
- Cube-Map Textures
- Shadow Samplers
- Depth-Stencil Textures
- Buffer Textures
- Linear Filtering
- Using and Generating Mipmaps
- Calculating the Mipmap Level
- Mipmap Level-of-Detail Control
- Explicit Level of Detail
- Explicit Gradient Specification
- Texture Fetch with Offsets
- Projective Texturing
- Texture Queries in Shaders
- Gathering Texels
- Combining Special Functions
- Textured Point Sprites
- Controlling the Appearance of Points
- Discarding Rendered Data
- Texture Redux
- Texture Best Practices
- Lighting Introduction
- Classic Lighting Model
- Fragment Shaders for Different Light Styles
- Moving Calculations to the Vertex Shader
- Multiple Lights and Materials
- Lighting Coordinate Systems
- Limitations of the Classic Lighting Model
- Hemisphere Lighting
- Image-Based Lighting
- Lighting with Spherical Harmonics
- Creating a Shadow Map
- Procedural Texturing
- Regular Patterns
- Toy Ball
- Lattice
- Procedural Shading Summary
- Application Setup
- Vertex Shader
- Fragment Shader
- Normal Maps
- Sources of Aliasing
- Avoiding Aliasing
- Increasing Resolution
- Antialiasing High Frequencies
- Frequency Clamping
- Procedural Antialiasing Summary
- Definition of Noise
- Noise Textures
- Trade-offs
- A Simple Noise Shader
- Turbulence
- Marble
- Granite
- Wood
- Noise Summary
- Tessellation Shaders
- Tessellation Patches
- Tessellation Control Shaders
- Generating Output-Patch Vertices
- Tessellation Control Shader Variables
- Controlling Tessellation
- Specifying the Primitive Generation Domain
- Specifying the Face Winding for Generated Primitives
- Specifying the Spacing of Tessellation Coordinates
- Additional Tessellation Evaluation Shader layout Options
- Specifying a Vertex’s Position
- Tessellation Evaluation Shader Variables
- Processing Patch Input Vertices
- Evaluating Tessellation Coordinates for the Teapot
- View-Dependent Tessellation
- Shared Tessellated Edges and Cracking
- Displacement Mapping
- Creating a Geometry Shader
- Geometry Shader Inputs and Outputs
- Geometry Shader Inputs
- Special Geometry Shader Primitives
- Geometry Shader Outputs
- Culling Geometry
- Geometry Amplification
- Multiple Output Streams
- Primitive Queries
- Using Transform Feedback Results
- Viewport Index
- Layered Rendering
- Geometry Shader Redux
- Geometry Shader Best Practices
- Using Textures for Generic Data Storage
- Binding Textures to Image Units
- Reading from and Writing to Images
- Writing Structured Data
- Atomic Operations on Images
- Atomic Operations on Buffers
- Sync Objects
- Image Qualifiers and Barriers
- High Performance Atomic Counters
- Order-Independent Transparency
- Overview
- Workgroups and Dispatch
- Knowing Where You Are
- Communication
- Synchronization
- Physical Simulation
- Image Processing
- Compute Shader Redux
- Compute Shader Best Practices
- Initializing and Creating a Window
- Accessing Functions
- Handling Window and Input Events
- Managing a Background Process
- Running the Program
- OpenGL ES
- WebGL
- Setting up WebGL within an HTML5 page
- Initializing Shaders in WebGL
- Initializing Vertex Data in WebGL
- Using Texture Maps in WebGL
- Built-in Variables
- Built-in Variable Declarations
- Built-in Variable Descriptions
- Angle and Trigonometry Functions
- Exponential Functions
- Common Functions
- Floating-Point Pack and Unpack Functions
- Geometric Functions
- Matrix Functions
- Vector Relational Functions
- Integer Functions
- Texture Functions
- Atomic-Counter Functions
- Atomic Memory Functions
- Image Functions
- Fragment Processing Functions
- Noise Functions
- Geometry Shader Functions
- Shader Invocation Control Functions
- Shader Memory Control Functions
- The Query Commands
- OpenGL State Variables
- Current Values and Associated Data
- Vertex Array Object State
- Vertex Array Data
- Buffer Object State
- Transformation State
- Coloring State
- Rasterization State
- Multisampling
- Textures
- Textures
- Textures
- Textures
- Texture Environment
- Pixel Operations
- Framebuffer Controls
- Framebuffer State
- Framebuffer State
- Frambuffer State
- Renderbuffer State
- Renderbuffer State
- Pixel State
- Shader Object State
- Shader Program Pipeline Object State
- Shader Program Object State
- Program Interface State
- Program Object Resource State
- Vertex and Geometry Shader State
- Query Object State
- Image State
- Transform Feedback State
- Atomic Counter State
- Shader Storage Buffer State
- Sync Object State
- Hints
- Compute Dispatch State
- Implementation-Dependent Values
- Tessellation Shader Implementation-Dependent Limits
- Geometry Shader Implementation-Dependent Limits
- Fragment Shader Implementation-Dependent Limits
- Implementation-Dependent Compute Shader Limits
- Implementation-Dependent Shader Limits
- Implementation-Dependent Debug Output State
- Implementation-Dependent Values
- Internal Format-Dependent Values
- Implementation-Dependent Transform Feedback Limits
- Framebuffer-Dependent Values
- Miscellaneous
- Homogeneous Coordinates
- Transforming Vertices
- Transforming Normals
- Translation
- Scaling
- Rotation
- Perspective Projection
- Orthographic Projection
- Accessing New OpenGL Functions
- GLEW: The OpenGL Extension Wrangler
- Initialization
- Controlling Rendering
- GLX Prototypes
- Initialization
- Controlling Rendering
- WGL Prototypes
- Initialization
- Controlling Rendering
- CGL Prototypes
- Initialization
- Reduced-Precision Floating-Point Values
- 16-bit Floating-Point Values
- 10- and 11-bit Unsigned Floating-Point Values
- Creating a Debug Context
- Debug Output
- Debug Messages
- Filtering Messages
- Application-Generated Messages
- Naming Objects
- Profiling Tools
- In-Application Profiling
- Using Standard Layout Qualifiers
- The std140 Layout Rules
- The std430 Layout Rules
Show and hide more
Product information
- Title: OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition
- Author(s): Dave Shreiner, Graham Sellers, John M. Kessenich, Bill M. Licea-Kane
- Release date: March 2013
- Publisher(s): Addison-Wesley Professional
- ISBN: 9780132748445