From Fundamentals to Advanced Graphics Programming
Introduction
- Why OpenGL ES
- What This Book Covers
- Prerequisites and How to Read This Book
- A Note on Versions and Compatibility
- The Journey Ahead
Chapter 1: Getting Started with OpenGL ES Development
- What Is OpenGL ES and Where Does It Run
- OpenGL ES 3.2: The Specification Landscape
- Toolchain Setup for Desktop Development
- Platform-Specific Development Environments
- Loading the OpenGL ES API: EGL and Platform Integration
- Your First OpenGL ES Application: A Minimal Working Example
- Summary
Chapter 2: GPU Architecture and the Rendering Pipeline
- Central Processing Versus Graphics Processing
- GPU Microarchitecture Overview
- The OpenGL ES Rendering Pipeline: A High-Level View
- Fixed-Function Versus Programmable Stages
- Understanding Throughput, Latency and Parallelism
- How OpenGL ES Commands Become GPU Work
Chapter 3: Graphics Contexts and Surface Management
- The EGL Layer: Why OpenGL ES Needs It
- Display Connection and Context Configuration
- Framebuffer Surfaces and Pixel Formats
- Context Sharing and Multiple Contexts
- Platform-Specific Surface Creation
- The Presentation Pipeline: Swap Buffers and VSync
- Summary
Chapter 4: Building a Complete Application Framework
- Application Architecture: Main Loop and Event Handling
- Resource Management and Lifecycle
- Error Handling with OpenGL ES
- The Rendering Framework: A Complete Codebase
- Cross-Platform Abstraction Layer
- Build System Configuration
- Summary
Chapter 5: The Programmable Pipeline: Vertices to Fragments
- Pipeline Overview: The Full Journey of a Vertex
- Vertex Attribute Binding and Input Assembly
- Primitive Assembly and Geometry Organization
- Clipping and Viewport Transformation
- Rasterization and Fragment Generation
- Fragment Processing and Pixel Output
- Framebuffer Operations and Output Merging
- Summary
Chapter 6: Shaders and the OpenGL Shading Language
- Introduction to Shaders and Program Objects
- GLSL ES Syntax: Types, Variables and Scope
- Control Flow and Functions
- Vector and Matrix Operations
- Shader Compilation and Linking
- Vertex and Fragment Shaders: Your First Pair
- Debugging Shader Errors and Warnings
- Summary
Chapter 7: Vertex Data and Buffer Objects
- Vertex Attributes and Layout Specification
- Vertex Buffer Objects: Creating and Filling Buffers
- Vertex Array Objects: State Packaging
- Element Array Buffers and Indexed Rendering
- Buffer Storage and Memory Mapping
- Advanced Layout: Instancing and Attributes
- Performance Considerations for Buffer Management
- Summary
Chapter 8: Geometry, Primitives and Coordinate Systems
- Primitive Types and Topology
- Constructing 2D and 3D Geometry
- Local to World: Model Transformations
- World to View: Camera Space
- Viewing Projections: Perspective and Orthographic
- The Complete Transformation Pipeline
- Summary
Chapter 9: Camera Systems and View Matrices
- Camera Parameters: Position, Orientation and Field of View
- View Matrix Construction from Camera State
- LookAt and Basis Vectors
- Projection Mathematics: Deriving the Perspective Matrix
- Orthographic Projection and UI Rendering
- Camera Controls and Interactivity
- Summary
Chapter 10: Rasterization, Clipping and Viewport Mapping
- The Rasterization Process: Scan Conversion
- Clipping and Conservative Rendering
- Viewport Transformation and Scissor Testing
- Primitive Restart and Degenerate Triangles
- Polygon Offset and Z-Fighting
- Multisampling and Anti-Aliasing Fundamentals
- Summary
Chapter 11: Texture Mapping and Sampling
- Texture Objects and the Texture Pipeline
- Texture Coordinates and UV Mapping
- Texture Formats: Internal Formats and Pixel Types
- Filtering: Linear, Nearest and Anisotropic
- Mipmapping: Generation and Sampling
- Wrapping: Texture Coordinate Clamping and Repetition
- Cubemaps and Environment Mapping
- Texture Arrays and Multi-Texture Sampling
- Advanced Texture Features in OpenGL ES 3.2
- Summary
Chapter 12: Framebuffer Objects and Render Targets
- Framebuffer Objects: Concept and API
- Renderbuffers Versus Texture Attachments
- Multiple Render Targets (MRT)
- Depth and Stencil Buffer Attachments
- Render-to-Texture for Post-Processing
- Debugging Framebuffer Completeness
- Multi-View Rendering for VR
- Summary
Chapter 13: Depth Testing, Blending and Testing
- Depth Testing and the Depth Buffer
- Depth Mask and Depth Functions
- Stencil Buffer Operations
- Color Blending: Theory and Practice
- Logical Operations and Color Masking
- Face Culling and Front/Back Determination
- Scissor Testing and Viewport Control
- Summary
Chapter 14: Lighting and Materials
- The Physics of Light: Reflection and Shading
- Ambient, Diffuse and Specular Components
- Phong and Blinn-Phong Shading Models
- Material Properties and Surface Appearance
- Point Lights, Directional Lights and Spotlights
- Multiple Lights and Accumulation
- Ambient Occlusion Approximation
- Summary
Chapter 15: Shadow Mapping and Advanced Lighting
- Shadow Mapping: Rendering from the Light
- Shadow Comparison Samplers in GLSL ES
- PCF Soft Shadows
- Cascaded Shadow Maps for Large Scenes
- Shadow Mapping Pitfalls and Solutions
- Light Volumes and Volumetric Effects
- Summary
Chapter 16: Uniform Buffer Objects and Shader Storage
- Uniform Variables and Limitations
- Uniform Buffer Objects: Layout and Binding
- Standard and Shared Storage Layouts
- Shader Storage Buffer Objects
- Image Load and Store in Fragment Shaders
- Atomic Operations in GLSL ES
- Choosing the Right Data Path
- Summary
Chapter 17: Compute Shaders and GPU Computation
- Compute Shader Fundamentals and Execution Model
- Work Groups, Local IDs and Global IDs
- Shared Memory and Thread Cooperation
- Memory Barriers in Compute Shaders
- Image Load/Store for Compute
- Practical Compute Applications
- Dispatch Indirect and Dynamic Workloads
- Summary
Chapter 18: Advanced Rendering Techniques
- Post-Processing Pipelines
- Bloom and Glow Effects
- Tone Mapping and Color Grading
- Deferred Shading Fundamentals
- Normal Mapping and Parallax Mapping
- Geometry Instancing and GPU-Driven Rendering
- Indirect Drawing Commands
- Summary
Chapter 19: Synchronization, Queries and Performance
- Fence Sync Objects and Waiting
- Semaphore Sync for Context Sharing
- Query Objects: Timing and Occlusion
- Memory Barriers and Ordering Guarantees
- Profiling GPU Performance
- CPU-GPU Latency and Pipeline Stalls
- Best Practices for Synchronization
- Summary
Chapter 20: Debugging, Validation and Tools
- OpenGL ES Error Handling: glGetError and Debug Callbacks
- Using the KHR_debug Extension
- RenderDoc and GPU Debugging
- Shader Validation and Static Analysis
- Common Rendering Bugs and How to Find Them
- Performance Debugging with Profilers
- Summary
Chapter 21: Optimization and Production Best Practices
- Understanding GPU Performance Characteristics
- Reducing Draw Calls and State Changes
- Vertex Cache and Triangle Strip Optimization
- Texture Memory and Streaming
- Shader Optimization and Instruction Budget
- Power and Thermal Considerations on Mobile
- Memory Management and Resource Pooling
- Summary
Chapter 22: Extensions and Platform Portability
- The Extension System in OpenGL ES
- Querying and Enabling Extensions
- Major Vendor-Specific Extensions
- Android OpenGL ES Development
- Embedded Linux and Wayland/X11
- Handling Hardware Diversity
- Graceful Degradation Strategies
- Summary
Chapter 23: Building a Complete Real-Time Renderer
- Project Architecture and Design Decisions
- Resource Loading and Scene Graph
- The Rendering Loop: Culling and Submission
- Shadow Mapping Integration
- Post-Processing Pipeline
- Input Handling and Camera Control
- Performance Profiling and Tuning
- Production Deployment Considerations
- Summary