- ホーム
- > 洋書
- > 英文書
- > Computer / General
Full Description
OpenGL ES 2.0 is the industry's leading software interface and graphics library for rendering sophisticated 3D graphics on handheld and embedded devices. With OpenGL ES 2.0, the full programmability of shaders is now available on small and portable devices-including cell phones, PDAs, consoles, appliances, and vehicles. However, OpenGL ES differs significantly from OpenGL. Graphics programmers and mobile developers have had very little information about it-until now. 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. Coverage includes:Shaders in depth: creating shader objects, compiling shaders, checking for compile errors, attaching shader objects to program objects, and linking final program objects The OpenGL ES Shading Language: variables, types, constructors, structures, arrays, attributes, uniforms, varyings, precision qualifiers, and invariance Inputting geometry into the graphics pipeline, and assembling geometry into primitives Vertex shaders, their special variables, and their use in per-vertex lighting, skinning, and other applications Using fragment shaders-including examples of multitexturing, fog, alpha test, and user clip planes Fragment operations: scissor test, stencil test, depth test, multisampling, blending, and dithering Advanced rendering: per-pixel lighting with normal maps, environment mapping, particle systems, image post-processing, and projective texturing Real-world programming challenges: platform diversity, C++ portability, OpenKODE, and platform-specific shader binaries
Contents
List of Figures xiiiList of Examples xvList of Tables xixForeword xxiPreface xxiiiAcknowledgments xxixAbout the Authors xxxiChapter 1. Introduction to OpenGL ES 2.0 1What Is OpenGL ES? 1OpenGL ES 2.0 3Vertex Shader 4Primitive Assembly 6Rasterization 7Fragment Shader 7Per-Fragment Operations 9OpenGL ES 2.0 and OpenGL ES 1.x Backward Compatibility 11EGL 12Programming with OpenGL ES 2.0 13Further Reading 18Chapter 2. Hello Triangle: An OpenGL ES 2.0 Example 19Code Framework 20Where to Download the Examples 20Hello Triangle Example 21Building and Running the Examples 25Using the OpenGL ES 2.0 Framework 26Creating a Simple Vertex and Fragment Shader 27Compiling and Loading the Shaders 29Creating a Program Object and Linking the Shaders 30Setting the Viewport and Clearing the Color Buffer 32Loading the Geometry and Drawing a Primitive 33Displaying the Back Buffer 33Chapter 3. An Introduction to EGL 35Communicating with the Windowing System 36Checking for Errors 37Initializing EGL 37Determining the Available Surface Configurations 38Querying EGLConfig Attributes 39Letting EGL Choose the Config 39Creating an On-Screen Rendering Area: The EGL Window 43Creating an Off-Screen Rendering Area: EGL Pbuffers 46Creating a Rendering Context 50Making an EGLContext Current 52Putting All Our EGL Knowledge Together 52Synchronizing Rendering 54Chapter 4. Shaders and Programs 57Shaders and Programs 57Uniforms and Attributes 67Shader Compiler and Shader Binaries 72Chapter 5. OpenGL ES Shading Language 77OpenGL ES Shading Language Basics 78Variables and Variable Types 78Variable Constructors 79Vector and Matrix Components 81Constants 82Structures 82Arrays 83Operators 84Functions 85Built-In Functions 86Control Flow Statements 87Uniforms 88Attributes 89Varyings 90Preprocessor and Directives 92Uniform and Varying Packing 94Precision Qualifiers 96Invariance 97Chapter 6. Vertex Attributes, Vertex Arrays, and Buffer Objects 101Specifying Vertex Attribute Data 102Declaring Vertex Attribute Variables in a Vertex Shader 110Vertex Buffer Objects 115Mapping Buffer Objects 124Chapter 7. Primitive Assembly and Rasterization 127Primitives 127Drawing Primitives 131Primitive Assembly 136Rasterization 141Chapter 8. Vertex Shaders 147Vertex Shader Overview 148Vertex Shader Examples 159Generating Texture Coordinates 167Vertex Skinning 168OpenGL ES 1.1 Vertex Pipeline as an ES 2.0 Vertex Shader 173Chapter 9. Texturing 181Texturing Basics 181Compressed Textures 201Texture Subimage Specification 202Copying Texture Data from the Color Buffer 204Optional Extensions 207Chapter 10. Fragment Shaders 215Fixed Function Fragment Shaders 216Fragment Shader Overview 218Implementing Fixed Function Techniques Using Shaders 222Chapter 11. Fragment Operations 233Buffers 234Fragment Tests and Operations 238Blending 246Dithering 249Multisampled Antialiasing 249Reading and Writing Pixels to the Framebuffer 250Chapter 12. Framebuffer Objects 253Why Framebuffer Objects 253Framebuffer and Renderbuffer Objects 255Creating Framebuffer and Renderbuffer Objects 258Using Renderbuffer Objects 259Using Framebuffer Objects 262Deleting Framebuffer and Renderbuffer Objects 269Examples 271Performance Tips and Tricks 277Chapter 13. Advanced Programming with OpenGL ES 2.0 279Per-Fragment Lighting 279Environment Mapping 286Particle System with Point Sprites 290Image Postprocessing 296Projective Texturing 300Noise Using a 3D Texture 307Procedural Texturing 315Chapter 14. State Queries 323OpenGL ES 2.0 Implementation String Queries 323Querying Implementation-Dependent Limits 324Querying OpenGL ES State 327Hints 330Entity Name Queries 331Nonprogrammable Operations Control and Queries 332Shader and Program State Queries 333Vertex Attribute Queries 335Texture State Queries 336Vertex Buffer Queries 337Renderbuffer and Framebuffer State Queries 337Chapter 15. OpenGL ES and EGL on Handheld Platforms 339Handheld Platforms Overview 339C++ Portability 341OpenKODE 343Platform-Specific Shader Binaries 350Targeting Extensions 351Appendix A. GL_HALF_FLOAT_OES 35316-Bit Floating-Point Number 354Converting Float to Half-Float 355Appendix B. Built-In Functions 357Angle and Trigonometry Functions 358Exponential Functions 360Common Functions 361Geometric Functions 364Matrix Functions 366Vector Relational Functions 367Texture Lookup Functions 369Derivative Functions 371Appendix C. Shading Language Grammar 375Appendix D. ES Framework API 385Framework Core Functions 385Transformation Functions 390Index 395