Opengl ES 2.0.25
Total Page:16
File Type:pdf, Size:1020Kb
OpenGL R ES Common Profile Specification Version 2.0.25 (Full Specification) (November 2, 2010) Editors (version 2.0): Aaftab Munshi, Jon Leech Copyright c 2002-2010 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, repub- lished, distributed, transmitted, displayed, broadcast or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be re- formatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group web-site should be included whenever possible with specification distributions. Khronos Group makes no, and expressly disclaims any, representations or war- ranties, express or implied, regarding this specification, including, without limita- tion, any implied warranties of merchantability or fitness for a particular purpose or non-infringement of any intellectual property. Khronos Group makes no, and expressly disclaims any, warranties, express or implied, regarding the correctness, accuracy, completeness, timeliness, and reliability of the specification. Under no circumstances will the Khronos Group, or any of its Promoters, Contributors or Members or their respective partners, officers, directors, employees, agents or rep- resentatives be liable for any damages, whether direct, indirect, special or conse- quential damages for lost revenues, lost profits, or otherwise, arising from or in connection with these materials. Khronos is a trademark of The Khronos Group Inc. OpenGL is a registered trade- mark, and OpenGL ES is a trademark, of Silicon Graphics, Inc. Contents 1 Introduction1 1.1 Comments on edits to the OpenGL ES 2.0 Specification . .1 1.2 What is the OpenGL ES Graphics System? . .1 1.3 Programmer’s View of OpenGL ES . .2 1.4 Implementor’s View of OpenGL ES . .2 1.5 Our View . .3 1.6 Companion Documents . .3 1.6.1 Window System Bindings . .3 2 OpenGL ES Operation4 2.1 OpenGL ES Fundamentals . .4 2.1.1 Numeric Computation . .6 2.1.2 Data Conversions . .7 2.2 GL State . .8 2.2.1 Shared Object State . .9 2.3 GL Command Syntax . .9 2.4 Basic GL Operation . 11 2.5 GL Errors . 14 2.6 Primitives and Vertices . 15 2.6.1 Primitive Types . 17 2.7 Current Vertex State . 19 2.8 Vertex Arrays . 19 2.9 Buffer Objects . 22 2.9.1 Vertex Arrays in Buffer Objects . 24 2.9.2 Array Indices in Buffer Objects . 25 2.10 Vertex Shaders . 26 2.10.1 Loading and Compiling Shader Source . 27 2.10.2 Loading Shader Binaries . 28 2.10.3 Program Objects . 29 i CONTENTS ii 2.10.4 Shader Variables . 32 2.10.5 Shader Execution . 40 2.10.6 Required State . 42 2.11 Primitive Assembly and Post-Shader Vertex Processing . 43 2.12 Coordinate Transformations . 44 2.12.1 Controlling the Viewport . 44 2.13 Primitive Clipping . 45 2.13.1 Clipping Varying Outputs . 46 3 Rasterization 48 3.1 Invariance . 49 3.2 Multisampling . 49 3.3 Points . 51 3.3.1 Point Multisample Rasterization . 51 3.4 Line Segments . 52 3.4.1 Basic Line Segment Rasterization . 52 3.4.2 Other Line Segment Features . 54 3.4.3 Line Rasterization State . 55 3.4.4 Line Multisample Rasterization . 55 3.5 Polygons . 56 3.5.1 Basic Polygon Rasterization . 57 3.5.2 Depth Offset . 58 3.5.3 Polygon Multisample Rasterization . 59 3.5.4 Polygon Rasterization State . 60 3.6 Pixel Rectangles . 60 3.6.1 Pixel Storage Modes . 60 3.6.2 Transfer of Pixel Rectangles . 61 3.7 Texturing . 65 3.7.1 Texture Image Specification . 66 3.7.2 Alternate Texture Image Specification Commands . 69 3.7.3 Compressed Texture Images . 73 3.7.4 Texture Parameters . 75 3.7.5 Cube Map Texture Selection . 76 3.7.6 Texture Wrap Modes . 77 3.7.7 Texture Minification . 78 3.7.8 Texture Magnification . 82 3.7.9 Texture Framebuffer Attachment . 82 3.7.10 Texture Completeness and Non-Power-Of-Two Textures . 83 3.7.11 Mipmap Generation . 84 3.7.12 Texture State . 84 Version 2.0.25 (November 2, 2010) CONTENTS iii 3.7.13 Texture Objects . 85 3.8 Fragment Shaders . 86 3.8.1 Shader Variables . 86 3.8.2 Shader Execution . 87 4 Per-Fragment Operations and the Framebuffer 90 4.1 Per-Fragment Operations . 91 4.1.1 Pixel Ownership Test . 91 4.1.2 Scissor Test . 93 4.1.3 Multisample Fragment Operations . 93 4.1.4 Stencil Test . 94 4.1.5 Depth Buffer Test . 96 4.1.6 Blending . 96 4.1.7 Dithering . 100 4.1.8 Additional Multisample Fragment Operations . 100 4.2 Whole Framebuffer Operations . 101 4.2.1 Selecting a Buffer for Writing . 101 4.2.2 Fine Control of Buffer Updates . 102 4.2.3 Clearing the Buffers . 103 4.3 Reading Pixels . 104 4.3.1 Reading Pixels . 104 4.3.2 Pixel Draw/Read State . 107 4.4 Framebuffer Objects . 107 4.4.1 Binding and Managing Framebuffer Objects . 107 4.4.2 Attaching Images to Framebuffer Objects . 110 4.4.3 Renderbuffer Objects . 110 4.4.4 Feedback Loops Between Textures and the Framebuffer . 114 4.4.5 Framebuffer Completeness . 116 4.4.6 Effects of Framebuffer State on Framebuffer Dependent Values . 119 4.4.7 Mapping between Pixel and Element in Attached Image . 120 4.4.8 Errors . 120 5 Special Functions 122 5.1 Flush and Finish . 122 5.2 Hints . 122 6 State and State Requests 124 6.1 Querying GL State . 124 6.1.1 Simple Queries . 124 Version 2.0.25 (November 2, 2010) CONTENTS iv 6.1.2 Data Conversions . 124 6.1.3 Enumerated Queries . 125 6.1.4 Texture Queries . 127 6.1.5 String Queries . 128 6.1.6 Buffer Object Queries . 128 6.1.7 Framebuffer Object and Renderbuffer Queries . 129 6.1.8 Shader and Program Queries . 129 6.2 State Tables . 134 A Invariance 159 A.1 Repeatability . 159 A.2 Multi-pass Algorithms . 160 A.3 Invariance Rules . 160 A.4 What All This Means . 161 B Corollaries 162 C Shared Objects and Multiple Contexts 164 C.1 Object Deletion Behavior . 165 C.1.1 Side Effects of Shared Context Destruction . 165 C.1.2 Automatic Unbinding of Deleted Objects . 165 C.1.3 Deleted Object and Object Name Lifetimes . 165 C.2 Propagating Changes to Objects . 166 C.2.1 Determining Completion of Changes to an object . 166 C.2.2 Definitions . 167 C.2.3 Rules . 167 D Version 2.0 169 E Extension Registry, Header Files, and Extension Naming Conventions 170 E.1 Extension Registry . 170 E.2 Header Files . 170 E.3 OES Extensions . 171 E.3.1 Naming Conventions . 171 E.4 Vendor and EXT Extensions . 171 E.4.1 Promoting Extensions to Core Features . 172 F Packaging and Acknowledgements 173 F.1 Header Files and Libraries . 173 F.2 Acknowledgements . 173 F.3 Document History . ..