Mobile 3D Graphics,
Edition 1
with OpenGL ES and M3G
Editors:
By Kari Pulli, Tomi Aarnio, Ville Miettinen, Kimmo Roimela and Jani Vaarala
Publication Date:
19 Nov 2007
Graphics and game developers must learn to program for mobility. This book will teach you how. "This book - written by some of the key technical experts...provides a comprehensive but practical and easily understood introduction for any software engineer seeking to delight the consumer with rich 3D interactive experiences on their phone. Like the OpenGL ES and M3G standards it covers, this book is destined to become an enduring standard for many years to come." - Lincoln Wallen, CTO, Electronic Arts, Mobile“This book is an escalator, which takes the field to new levels. This is especially true because the text ensures that the topic is easily accessible to everyone with some background in computer science...The foundations of this book are clear, and the authors are extremely knowledgeable about the subject.¿ - Tomas Akenine-Möller, bestselling author and Professor of Computer Science at Lund University "This book is an excellent introduction to M3G. The authors are all experienced M3G users and developers, and they do a great job of conveying that experience, as well as plenty of practical advice that has been proven in the field." - Sean Ellis, Consultant Graphics Engineer, ARM LtdThe exploding popularity of mobile computing is undeniable. From cell phones to portable gaming systems, the global demand for multifunctional mobile devices is driving amazing hardware and software developments. 3D graphics are becoming an integral part of these ubiquitous devices, and as a result, Mobile 3D Graphics is arguably the most rapidly advancing area of the computer graphics discipline. Mobile 3D Graphics is about writing real-time 3D graphics applications for mobile devices. The programming interfaces explained and demonstrated in this must-have reference enable dynamic 3D media on cell phones, GPS systems, portable gaming consoles and media players. The text begins by providing thorough coverage of background essentials, then presents detailed hands-on examples, including extensive working code in both of the dominant mobile APIs, OpenGL ES and M3G. C/C++ and Java Developers, graphic artists, students, and enthusiasts would do well to have a programmable mobile phone on hand to try out the techniques described in this book. The authors, industry experts who helped to develop the OpenGL ES and M3G standards, distill their years of accumulated knowledge within these pages, offering their insights into everything from sound mobile design principles and constraints, to efficient rendering, mixing 2D and 3D, lighting, texture mapping, skinning and morphing. Along the way, readers will benefit from the hundreds of included tips, tricks and caveats.
Key Features
- Written by experts at Nokia whose workshops at industry conferences are blockbusters
- The programs used in the examples are featured in thousands of professional courses each year
Contents
Preface
About the Authors
CHAPTER 1. INTRODUCTION
1.1 About This Book
1.1.1 Typographic Conventions
1.2 Graphics on Handheld Devices
1.2.1 Device Categories
1.2.2 Display Technology
1.2.3 Processing Power
1.2.4 Graphics Hardware
1.2.5 Execution Environments
1.3 Mobile Graphics Standards
1.3.1 Fighting the Fragmentation
1.3.2 Design Principles
1.3.3 OpenGL ES
1.3.4 M3G
1.3.5 Related Standards
PART I ANATOMY OF A GRAPHICS ENGINE
CHAPTER 2. LINEAR ALGEBRA FOR 3D GRAPHICS
2.1 Coordinate Systems
2.1.1 Vectors and Points
2.1.2 Vector Products
2.1.3 Homogeneous Coordinates
2.2 Matrices
2.2.1 Matrix Products
2.2.2 Identity and Inverse
2.2.3 Compound Transformations
2.2.4 Transforming Normal Vectors
2.3 Affine Transformations
2.3.1 Types of Affine Transformations
2.3.2 Transformation Around a Pivot
2.3.3 Example: Hierarchical Modeling
2.4 Eye Coordinate System
2.5 Projections
2.5.1 Near and Far Planes and the Depth Buffer
2.5.2 A General View Frustum
2.5.3 Parallel Projection
2.6 Viewport and 2D Coordinate Systems
CHAPTER 3. LOW-LEVEL RENDERING
3.1 Rendering Primitives
3.1.1 Geometric Primitives
3.1.2 Raster Primitives
3.2 Lighting
3.2.1 Color
3.2.2 Normal Vectors
3.2.3 Reflection Models and Materials
3.2.4 Lights
3.2.5 Full Lighting Equation
3.3 Culling and Clipping
3.3.1 Back-Face Culling
3.3.2 Clipping and View-Frustum Culling
3.4 Rasterization
3.4.1 Texture Mapping
3.4.2 Interpolating Gradients
3.4.3 Texture-Based Lighting
3.4.4 Fog
3.4.5 Antialiasing
3.5 Per-Fragment Operations
3.5.1 Fragment Tests
3.5.2 Blending
3.5.3 Dithering, Logical Operations, and Masking
3.6 Life Cycle of a Frame
3.6.1 Single versus Double Buffering
3.6.2 Complete Graphics System
3.6.3 Synchronization Points
CHAPTER 4. ANIMATION
4.1 Keyframe Animation
4.1.1 Interpolation
4.1.2 Quaternions
4.2 Deforming Meshes
4.2.1 Morphing
4.2.2 Skinning
4.2.3 Other Dvnamic Deformations
CHAPTER 5. SCENE MANAGEMENT
5.1 Triangle Meshes
5.2 Scene Graphs
5.2.1 Application Area
5.2.2 Spatial Data Structure
5.2.3 Content Creation
5.2.4 Extensibility
5.2.5 Class Hierarchy
5.3 Retained Mode Rendering
5.3.1 Setting Up the Camera and Lights
5.3.2 Resolving Rendering Slate
5.3.3 Finding Potentially Visible Objects
5.3.4 Sorting and Rendering
CHAPTER 6. PERFORMANCE AND SCALABILITY
6.1 Scalability
6.1.1 Special Effects
6.1.2 Tuning Down the Details
6.2 Performance Optimization
6.2.1 Pixel Pipeline
6.2.2 Vertex Pipeline
6.2.3 Application Code
6.2.4 Profiling OpenGL ES Based Applications
6.2.5 Checklists
6.3 Changing and Querying the State
6.3.1 Optimizing State Changes
6.4 Model Data
6.4.1 Vertex Data
6.4.2 Triangle Data
6.5 Transformation Pipeline
6.5.1 Object Hierarchies
6.5.2 Rendering Order
6.5.3 Culling
6.6 Lighting
6.6.1 Precomputed Illumination
6.7 Textures
6.7.1 Texture Storage
PART II OPENGL ES AND EGL
CHAPTER 7. INTRODUCING OPENGL ES
7.1 Khronos Group and OpenGL ES
7.2 Design Principles
7.3 Resources
7.3.1 Documentation
7.3.2 Technical Support
7.3.3 Implementations
7.4 API Overview
7.4.1 Profiles and Versions
7.4.2 OpenGL ES 1.0 in a Nutshell
7.4.3 New Features in OpenGL ES 1.1
7.4.4 Extension Mechanism
7.4.5 OpenGL ES Extension Pack
7.4.6 Utility APIs
7.4.7 Conventions
7.5 Hello, OpenGL ES!
CHAPTER 8. OPENGL ES TRANSFORMATION AND LIGHTING
8.1 Drawing Primitives
8.1.1 Primitive Types
8.1.2 Specifying Vertex Data
8.1.3 Drawing the Primitives
8.1.4 Vertex Buffer Objects
8.2 Vertex Transformation Pipeline
8.2.1 Matrices
8.2.2 Transforming Normals
8.2.3 Texture Coordinate Transformation
8.2.4 Matrix Stacks
8.2.5 Viewport Transformation
8.2.6 User Clip Planes
8.3 Colors and Lighting
8.3.1 Specifying Colors and Materials
8.3.2 Lights
8.3.3 Two-Sided Lighting
8.3.4 Shading
8.3.5 Lighting Example
CHAPTER 9. OPENGL ES RASTERIZATION AND FRAGMENT PROCESSING
9.1 Back-Face Culling
9.2 Texture Mapping
9.2.1 Texture Objects
9.2.2 Specifying Texture Data
9.2.3 Texture Filtering
9.2.4 Texture Wrap Modes
9.2.5 Basic Texture Functions
9.2.6 Multi-Texturing
9.2.7 Texture Combiners
9.2.8 Point Sprite Texturing
9.2.9 Implementation Differences
9.3 Fog
9.4 Antialiasing
9.4.1 Edge Antialiasing
9.4.2 Multisampling
9.4.3 Other Antialiasing Approaches
9.5 Pixel Tests
9.5.1 Scissoring
9.5.2 Alpha Test
9.5.3 Stencil Test
9.5.4 Depth Testing
9.6 Applying Fragments to the Color Buffer
9.6.1 Blending
9.6.2 Dithering
9.6.3 Logic Ops
9.6.4 Masking Frame Buffer Channels
CHAPTER 10. MISCELLANEOUS OPENGL ES FEATURES
10.1 Frame Buffer Operations
10.1.1 Clearing the Buffers
10.1.2 Reading Back the Color Buffer
10.1.3 Flushing the Command Stream
10.2 State Queries
10.2.1 Static State
10.2.2 Dynamic State Queries
10.3 Hints
10.4 Extensions
10.4.1 Querying Extensions
10.4.2 Query Matrix
10.4.3 Matrix Palette
10.4.4 Draw Texture
10.4.5 Using Extensions
CHAPTER 11. EGL
11.1 API Overview
11.2 Configuration
11.3 Surfaces
11.4 Contexts
11.5 Extensions
11.6 Rendering into Textures
11.7 Writing High-Performance EGL Code
11.8 Mixing OpenGL ES and 2D Rendering
11.8.1 Method 1: Window Surface is in Control
11.8.2 Method 2: Pbuffer Surfaces and Bitmaps
11.8.3 Method 3: Pixmap Surfaces
11.9 Optimizing Power Usage
11.9.1 Power Management Implementations
11.9.2 Optimizing the Active Mode
11.9.3 Optimizing the Idle Mode
11.9.4 Measuring Power Usage
11.10 Example on EGL Configuration Selection
PART III M3G
CHAPTER 12. INTRODUCING M3G
12.1 Overview
12.1.1 Mobile Java
12.1.2 Features and Structure
12.1.3 Hello, World
12.2 Design Principles and Conventions
I2.2.1 High Abstraction Level
12.2.2 No Events or Callbacks
12.2.3 Robust Arithmetic
12.2.4 Consistent Methods
12.2.5 Parameter Passing
12.2.6 Numeric Values
12.2.7 Enumerations
12.2.8 Error Handling
12.3 M3G 1.1
12.3.1 Pure 3D Rendering
12.3.2 Rotation Interpolation
12.3.3 PNG and JPEG Loading
12.3.4 New Getters
12.3.5 Other Changes
CHAPTER 13. BASIC M3G CONCEPTS
13.1 Graphics3D
13.1.1 Render Targets
13.1.2 Viewport
13.1.3 Rendering
13.1.4 Static Properties
13.2 Image2D
13.3 Matrices and Transformations
13.3.1 Transform
13.3.2 Transformable
13.4 Object3D
13.4.1 Animating
13.4.2 Iterating and Cloning
13.4.3 Tags and Annotations
13.5 Importing Content
13.5.1 Loader
13.5.2 The File Format
CHAPTER 14. LOW-LEVEL MODELING IN M3G
14.1 Building meshes
14.1.1 VertexArray
14.1.2 VertexBuffer
14.1.3 IndexBuffer and Rendering Primitives
14.1.4 Example
14.2 Adding Color and Light: Appearance
14.2.1 PolygonMode
14.2.2 Material
14.2.3 Texture2D
14.2.4 Fog
14.2.5 CompositingMode
14.3 Lights and Camera
14.3.1 Camera
14.3.2 Light
14.4 2D Primitives
14.4.1 Background
14.4.2 Sprite3D
CHAPTER 15. THE M3G SCENE GRAPH
15.1 Scene Graph Basics: Node, Group, and World
15.2 Mesh Objects
15.3 Transforming Objects
15.3.1 Camera, Light, and Viewing Transformations
15.3.2 Node Alignment
15.4 Layering and Multi-Pass Effects
15.5 Picking
15.6 Optimizing Performance
15.6.1 Visibility Optimization
15.6.2 Scope Masks
CHAPTER 16. ANIMATION IN M3G
16.1 Keyframe Animation: KeyframeSequence
16.2 Animation Targets: AnimationTrack
16.3 Timing and Speed: AnimationController
16.4 Animation Execution
16.5 Advanced Animation
16.5.1 Deformable Meshes
16.5.2 Animation Blending
16.5.3 Creating Discontinuities
16.5.4 Dynamic Animation
PART IV APPENDIX
A FIXED-POINT MATHEMATICS
A.1 Fixed-Point Methods in C
A.1.1 Basic Operations
A.1.2 Shared Exponents
A.1.3 Trigonometric Operations
A.2 Fixed-Point Methods in Assembly Language
A.3 Fixed-Point Methods in Java
B JAVA PERFORMANCE TUNING
B.1 Virtual Machines
B.2 Bytecode Optimization
B.3 Garbage Collection
B.4 Memory Accesses
B.5 Method Calls
C GLOSSARY
Bibliography
Index
Preface
About the Authors
CHAPTER 1. INTRODUCTION
1.1 About This Book
1.1.1 Typographic Conventions
1.2 Graphics on Handheld Devices
1.2.1 Device Categories
1.2.2 Display Technology
1.2.3 Processing Power
1.2.4 Graphics Hardware
1.2.5 Execution Environments
1.3 Mobile Graphics Standards
1.3.1 Fighting the Fragmentation
1.3.2 Design Principles
1.3.3 OpenGL ES
1.3.4 M3G
1.3.5 Related Standards
PART I ANATOMY OF A GRAPHICS ENGINE
CHAPTER 2. LINEAR ALGEBRA FOR 3D GRAPHICS
2.1 Coordinate Systems
2.1.1 Vectors and Points
2.1.2 Vector Products
2.1.3 Homogeneous Coordinates
2.2 Matrices
2.2.1 Matrix Products
2.2.2 Identity and Inverse
2.2.3 Compound Transformations
2.2.4 Transforming Normal Vectors
2.3 Affine Transformations
2.3.1 Types of Affine Transformations
2.3.2 Transformation Around a Pivot
2.3.3 Example: Hierarchical Modeling
2.4 Eye Coordinate System
2.5 Projections
2.5.1 Near and Far Planes and the Depth Buffer
2.5.2 A General View Frustum
2.5.3 Parallel Projection
2.6 Viewport and 2D Coordinate Systems
CHAPTER 3. LOW-LEVEL RENDERING
3.1 Rendering Primitives
3.1.1 Geometric Primitives
3.1.2 Raster Primitives
3.2 Lighting
3.2.1 Color
3.2.2 Normal Vectors
3.2.3 Reflection Models and Materials
3.2.4 Lights
3.2.5 Full Lighting Equation
3.3 Culling and Clipping
3.3.1 Back-Face Culling
3.3.2 Clipping and View-Frustum Culling
3.4 Rasterization
3.4.1 Texture Mapping
3.4.2 Interpolating Gradients
3.4.3 Texture-Based Lighting
3.4.4 Fog
3.4.5 Antialiasing
3.5 Per-Fragment Operations
3.5.1 Fragment Tests
3.5.2 Blending
3.5.3 Dithering, Logical Operations, and Masking
3.6 Life Cycle of a Frame
3.6.1 Single versus Double Buffering
3.6.2 Complete Graphics System
3.6.3 Synchronization Points
CHAPTER 4. ANIMATION
4.1 Keyframe Animation
4.1.1 Interpolation
4.1.2 Quaternions
4.2 Deforming Meshes
4.2.1 Morphing
4.2.2 Skinning
4.2.3 Other Dvnamic Deformations
CHAPTER 5. SCENE MANAGEMENT
5.1 Triangle Meshes
5.2 Scene Graphs
5.2.1 Application Area
5.2.2 Spatial Data Structure
5.2.3 Content Creation
5.2.4 Extensibility
5.2.5 Class Hierarchy
5.3 Retained Mode Rendering
5.3.1 Setting Up the Camera and Lights
5.3.2 Resolving Rendering Slate
5.3.3 Finding Potentially Visible Objects
5.3.4 Sorting and Rendering
CHAPTER 6. PERFORMANCE AND SCALABILITY
6.1 Scalability
6.1.1 Special Effects
6.1.2 Tuning Down the Details
6.2 Performance Optimization
6.2.1 Pixel Pipeline
6.2.2 Vertex Pipeline
6.2.3 Application Code
6.2.4 Profiling OpenGL ES Based Applications
6.2.5 Checklists
6.3 Changing and Querying the State
6.3.1 Optimizing State Changes
6.4 Model Data
6.4.1 Vertex Data
6.4.2 Triangle Data
6.5 Transformation Pipeline
6.5.1 Object Hierarchies
6.5.2 Rendering Order
6.5.3 Culling
6.6 Lighting
6.6.1 Precomputed Illumination
6.7 Textures
6.7.1 Texture Storage
PART II OPENGL ES AND EGL
CHAPTER 7. INTRODUCING OPENGL ES
7.1 Khronos Group and OpenGL ES
7.2 Design Principles
7.3 Resources
7.3.1 Documentation
7.3.2 Technical Support
7.3.3 Implementations
7.4 API Overview
7.4.1 Profiles and Versions
7.4.2 OpenGL ES 1.0 in a Nutshell
7.4.3 New Features in OpenGL ES 1.1
7.4.4 Extension Mechanism
7.4.5 OpenGL ES Extension Pack
7.4.6 Utility APIs
7.4.7 Conventions
7.5 Hello, OpenGL ES!
CHAPTER 8. OPENGL ES TRANSFORMATION AND LIGHTING
8.1 Drawing Primitives
8.1.1 Primitive Types
8.1.2 Specifying Vertex Data
8.1.3 Drawing the Primitives
8.1.4 Vertex Buffer Objects
8.2 Vertex Transformation Pipeline
8.2.1 Matrices
8.2.2 Transforming Normals
8.2.3 Texture Coordinate Transformation
8.2.4 Matrix Stacks
8.2.5 Viewport Transformation
8.2.6 User Clip Planes
8.3 Colors and Lighting
8.3.1 Specifying Colors and Materials
8.3.2 Lights
8.3.3 Two-Sided Lighting
8.3.4 Shading
8.3.5 Lighting Example
CHAPTER 9. OPENGL ES RASTERIZATION AND FRAGMENT PROCESSING
9.1 Back-Face Culling
9.2 Texture Mapping
9.2.1 Texture Objects
9.2.2 Specifying Texture Data
9.2.3 Texture Filtering
9.2.4 Texture Wrap Modes
9.2.5 Basic Texture Functions
9.2.6 Multi-Texturing
9.2.7 Texture Combiners
9.2.8 Point Sprite Texturing
9.2.9 Implementation Differences
9.3 Fog
9.4 Antialiasing
9.4.1 Edge Antialiasing
9.4.2 Multisampling
9.4.3 Other Antialiasing Approaches
9.5 Pixel Tests
9.5.1 Scissoring
9.5.2 Alpha Test
9.5.3 Stencil Test
9.5.4 Depth Testing
9.6 Applying Fragments to the Color Buffer
9.6.1 Blending
9.6.2 Dithering
9.6.3 Logic Ops
9.6.4 Masking Frame Buffer Channels
CHAPTER 10. MISCELLANEOUS OPENGL ES FEATURES
10.1 Frame Buffer Operations
10.1.1 Clearing the Buffers
10.1.2 Reading Back the Color Buffer
10.1.3 Flushing the Command Stream
10.2 State Queries
10.2.1 Static State
10.2.2 Dynamic State Queries
10.3 Hints
10.4 Extensions
10.4.1 Querying Extensions
10.4.2 Query Matrix
10.4.3 Matrix Palette
10.4.4 Draw Texture
10.4.5 Using Extensions
CHAPTER 11. EGL
11.1 API Overview
11.2 Configuration
11.3 Surfaces
11.4 Contexts
11.5 Extensions
11.6 Rendering into Textures
11.7 Writing High-Performance EGL Code
11.8 Mixing OpenGL ES and 2D Rendering
11.8.1 Method 1: Window Surface is in Control
11.8.2 Method 2: Pbuffer Surfaces and Bitmaps
11.8.3 Method 3: Pixmap Surfaces
11.9 Optimizing Power Usage
11.9.1 Power Management Implementations
11.9.2 Optimizing the Active Mode
11.9.3 Optimizing the Idle Mode
11.9.4 Measuring Power Usage
11.10 Example on EGL Configuration Selection
PART III M3G
CHAPTER 12. INTRODUCING M3G
12.1 Overview
12.1.1 Mobile Java
12.1.2 Features and Structure
12.1.3 Hello, World
12.2 Design Principles and Conventions
I2.2.1 High Abstraction Level
12.2.2 No Events or Callbacks
12.2.3 Robust Arithmetic
12.2.4 Consistent Methods
12.2.5 Parameter Passing
12.2.6 Numeric Values
12.2.7 Enumerations
12.2.8 Error Handling
12.3 M3G 1.1
12.3.1 Pure 3D Rendering
12.3.2 Rotation Interpolation
12.3.3 PNG and JPEG Loading
12.3.4 New Getters
12.3.5 Other Changes
CHAPTER 13. BASIC M3G CONCEPTS
13.1 Graphics3D
13.1.1 Render Targets
13.1.2 Viewport
13.1.3 Rendering
13.1.4 Static Properties
13.2 Image2D
13.3 Matrices and Transformations
13.3.1 Transform
13.3.2 Transformable
13.4 Object3D
13.4.1 Animating
13.4.2 Iterating and Cloning
13.4.3 Tags and Annotations
13.5 Importing Content
13.5.1 Loader
13.5.2 The File Format
CHAPTER 14. LOW-LEVEL MODELING IN M3G
14.1 Building meshes
14.1.1 VertexArray
14.1.2 VertexBuffer
14.1.3 IndexBuffer and Rendering Primitives
14.1.4 Example
14.2 Adding Color and Light: Appearance
14.2.1 PolygonMode
14.2.2 Material
14.2.3 Texture2D
14.2.4 Fog
14.2.5 CompositingMode
14.3 Lights and Camera
14.3.1 Camera
14.3.2 Light
14.4 2D Primitives
14.4.1 Background
14.4.2 Sprite3D
CHAPTER 15. THE M3G SCENE GRAPH
15.1 Scene Graph Basics: Node, Group, and World
15.2 Mesh Objects
15.3 Transforming Objects
15.3.1 Camera, Light, and Viewing Transformations
15.3.2 Node Alignment
15.4 Layering and Multi-Pass Effects
15.5 Picking
15.6 Optimizing Performance
15.6.1 Visibility Optimization
15.6.2 Scope Masks
CHAPTER 16. ANIMATION IN M3G
16.1 Keyframe Animation: KeyframeSequence
16.2 Animation Targets: AnimationTrack
16.3 Timing and Speed: AnimationController
16.4 Animation Execution
16.5 Advanced Animation
16.5.1 Deformable Meshes
16.5.2 Animation Blending
16.5.3 Creating Discontinuities
16.5.4 Dynamic Animation
PART IV APPENDIX
A FIXED-POINT MATHEMATICS
A.1 Fixed-Point Methods in C
A.1.1 Basic Operations
A.1.2 Shared Exponents
A.1.3 Trigonometric Operations
A.2 Fixed-Point Methods in Assembly Language
A.3 Fixed-Point Methods in Java
B JAVA PERFORMANCE TUNING
B.1 Virtual Machines
B.2 Bytecode Optimization
B.3 Garbage Collection
B.4 Memory Accesses
B.5 Method Calls
C GLOSSARY
Bibliography
Index
ISBN:
9780123737274
Page Count: 464
Retail Price
:
£52.99
Shreiner, et al: OpenGL Programming Guide 5e (2005, 0321335732, $59.99, £42.99, Addison Wesley, 896 pages, paper). Bookscan units: 4,044.
McReynolds & Blythe: Advanced Graphics Programming Using OpenGL (2005, 1558606599, $69.95 / £41.99, Morgan Kaufmann, 672 pages, cloth). Units sold: 3,529.
McReynolds & Blythe: Advanced Graphics Programming Using OpenGL (2005, 1558606599, $69.95 / £41.99, Morgan Kaufmann, 672 pages, cloth). Units sold: 3,529.
Mobile 3D graphics application developers (mainly programmers and technical leads in game development), graphic artists, producers, and students of mobile 3D graphics.
Related Titles