OpenGL ® ES (TM) is the industry's leading software interface and graphics library for rendering sophisticated 3D graphics on handheld and embedded devices. The newest version, OpenGL ES 3.0, makes it possible to create stunning visuals for new games and apps, without compromising device performance or battery life.

In the OpenGL® ES(TM) 3.0 Programming Guide, Second Edition, the authors cover the entire API and Shading Language. They carefully introduce OpenGL ES 3.0 features such as shadow mapping, instancing, multiple render targets, uniform buffer objects, texture compression, program binaries, and transform feedback.

Through detailed, downloadable C-based code examples, you'll learn how to set up and program every aspect of the graphics pipeline. Step by step, you'll move from introductory techniques all the way to advanced per-pixel lighting and particle systems. Throughout, you'll find cutting-edge tips for optimizing performance, maximizing efficiency with both the API and hardware, and fully leveraging OpenGL ES 3.0 in a wide spectrum of applications.

All code has been built and tested on iOS 7, Android 4.3, Windows (OpenGL ES 3.0 Emulation), and Ubuntu Linux, and the authors demonstrate how to build OpenGL ES code for each platform.

Coverage includes

  • EGL API: communicating with the native windowing system, choosing configurations, and creating rendering contexts and surfaces
  • Shaders: creating and attaching shader objects; compiling shaders; checking for compile errors; creating, linking, and querying program objects; and using source shaders and program binaries
  • OpenGL ES Shading Language: variables, types, constructors, structures, arrays, attributes, uniform blocks, I/O variables, precision qualifiers, and invariance
  • Geometry, vertices, and primitives: inputting geometry into the pipeline, and assembling it into primitives
  • 2D/3D, Cubemap, Array texturing: creation, loading, and rendering; texture wrap modes, filtering, and formats; compressed textures, sampler objects, immutable textures, pixel unpack buffer objects, and mipmapping
  • Fragment shaders: multitexturing, fog, alpha test, and user clip planes
  • Fragment operations: scissor, stencil, and depth tests; multisampling, blending, and dithering
  • Framebuffer objects: rendering to offscreen surfaces for advanced effects
  • Advanced rendering: per-pixel lighting, environment mapping, particle systems, image post-processing, procedural textures, shadow mapping, terrain, and projective texturing
  • Sync objects and fences: synchronizing within host application and GPU execution

This edition of the book includes a color insert of the OpenGL ES 3.0 API and OpenGL ES Shading Language 3.0 Reference Cards created by Khronos. The reference cards contain a complete list of all of the functions in OpenGL ES 3.0 along with all of the types, operators, qualifiers, built-ins, and functions in the OpenGL ES Shading Language.



Autorentext

Dan Ginsburg is founder of Upsample Software, LLC, a software consultancy specializing in 3D graphics and GPU computing. In previous roles he has worked on developing OpenGL drivers, desktop and handheld 3D demos, GPU developer tools, 3D medical visualization and games. He coauthored the OpenCL Programming Guide (Addison-Wesley, 2012).

Budi Purnomo is a senior software architect at Advanced Micro Devices, Inc. where he collaborates with many AMD architects to develop software infrastructure across multiple software stacks and to define future hardware architectures for debugging and profiling GPU applications.

Dave Shreiner is one of the World's foremost authorities on OpenGL. He is the series editor for the Addison-Wesley OpenGL Series.

Aatab Munshi is the spec editor for the OpenGL ES 1.1 and 2.0 specifications.



Inhalt

List of Figures xvii

List of Examples xxi

List of Tables xxv

Foreword xxix

Preface xxxi

Intended Audience xxxi

Organization of This Book xxxii

Example Code and Shaders xxxvi

Errata xxxvi

Acknowledgments xxxvii

About the Authors xxxix

Chapter 1: Introduction to OpenGL ES 3.0 1

OpenGL ES 3.0 3

What's New in OpenGL ES 3.0 11

OpenGL ES 3.0 and Backward Compatibility 17

EGL 19

EGL Command Syntax 20

OpenGL ES Command Syntax 21

Error Handling 22

Basic State Management 23

Further Reading 25

Chapter 2: Hello Triangle: An OpenGL ES 3.0 Example 27

Code Framework 28

Where to Download the Examples 28

Hello Triangle Example 29

Using the OpenGL ES 3.0 Framework 34

Creating a Simple Vertex and Fragment Shader 35

Compiling and Loading the Shaders 36

Creating a Program Object and Linking the Shaders 38

Setting the Viewport and Clearing the Color Buffer 39

Loading the Geometry and Drawing a Primitive 40

Displaying the Back Buffer 41

Summary 42

Chapter 3: An Introduction to EGL 43

Communicating with the Windowing System 44

Checking for Errors 45

Initializing EGL 46

Determining the Available Surface Configurations 46

Querying EGLConfig Attributes 48

Letting EGL Choose the Configuration 51

Creating an On-Screen Rendering Area: The EGL Window 53

Creating an Off-Screen Rendering Area: EGL Pbuffers 56

Creating a Rendering Context 60

Making an EGLContext Current 62

Putting All Our EGL Knowledge Together 63

Synchronizing Rendering 66

Summary 67

Chapter 4: Shaders and Programs 69

Shaders and Programs 69

Uniforms and Attributes 80

Shader Compiler 93

Program Binaries 94

Summary 95

Chapter 5: OpenGL ES Shading Language 97

OpenGL ES Shading Language Basics 98

Shader Version Specification 98

Variables and Variable Types 99

Variable Constructors 100

Vector and Matrix Components 101

Constants 102

Structures 103

Arrays 104

Operators 104

Functions 106

Built-In Functions 107

Control Flow Statements 107

Uniforms 108

Uniform Blocks 109

Vertex and Fragment Shader Inputs/Outputs 111

Interpolation Qualifiers 114

Preprocessor and Directives 115

Uniform and Interpolator Packing 117

Precision Qualifiers 119

Invariance 121

Summary 123

Chapter 6: Vertex Attributes, Vertex Arrays, and Buffer Objects 125

Specifying Vertex Attribute Data 126

Declaring Vertex Attribute Variables in a Vertex Shader 135

Vertex Buffer Objects 140

Vertex Array Objects 150

Mapping Buffer Objects 154

Copying Buffer Objects 159

Summary 160

Chapter 7: Primitive Assembly and Rasterization 161

Primitives 161

Drawing Primitives 165

Primitive Assembly 174

Rasterization 179

Occlusion Queries 183

Summary 185

Chapter 8: Vertex Shaders 187

Vertex Shader Overview 188

Vertex Shader Examples 196

Generating Texture Coordinates 205

Vertex Skinning 207

Transform Feedback 211

Vertex Textures 214

OpenGL ES 1.1 Vertex Pipeline as an ES 3.0 Vertex Shader 215

Summary 223

Chapter 9: Texturing 225

Texturing Basics 226

Compressed Textures 262

Texture Subimage Specification 266

Copying Texture Data from the Color Buffer 269

Sampler…

Titel
OpenGL ES 3.0 Programming Guide
EAN
9780133440126
Format
E-Book (epub)
Hersteller
Veröffentlichung
28.02.2014
Digitaler Kopierschutz
Wasserzeichen
Dateigrösse
37.27 MB
Anzahl Seiten
560