www.khronos.org/opengles
©2010 Khronos Group - Rev. 0210
OpenGL ES 2.0 API Quick Reference CardOpenGL ES 2.0 API Quick Reference Card
Shaders and Programs
Shader Objects [2.10.1]
uint CreateShader(enum type);
type: VERTEX_SHADER, FRAGMENT_SHADER
void ShaderSource(uint shader, sizei count,
const char **string, const int *length);
void CompileShader(uint shader);
void ReleaseShaderCompiler(void);
void DeleteShader(uint shader);
Loading Shader Binaries [2.10.2]
void ShaderBinary(sizei count, const uint *shaders,
enum binaryformat, const void *binary, sizei length);
Program Objects [2.10.3]
uint CreateProgram(void);
void AachShader(uint program, uint shader);
void DetachShader(uint program, uint shader);
void LinkProgram(uint program);
void UseProgram(uint program);
void DeleteProgram(uint program);
Shader Variables [2.10.4]
Vertex Aributes
void GetAcveArib(uint program, uint index,
sizei bufSize, sizei *length, int *size, enum *type,
char *name);
*type returns: FLOAT, FLOAT_VEC{2,3,4}, FLOAT_MAT{2,3,4}
int GetAribLocaon(uint program, const char *name);
void BindAribLocaon(uint program, uint index,
const char *name);
Uniform Variables
int GetUniformLocaon(uint program, const char *name);
void GetAcveUniform(uint program, uint index,
sizei bufSize, sizei *length, int *size, enum *type,
char *name);
*type: FLOAT, FLOAT_VEC{2,3,4}, INT, INT_VEC{2,3,4}, BOOL,
BOOL_VEC{2,3,4}, FLOAT_MAT{2,3,4}, SAMPLER_2D,
SAMPLER_CUBE
void Uniform{1234}{if}(int locaon, T value);
void Uniform{1234}{if}v(int locaon, sizei count, T value);
void UniformMatrix{234}fv(int locaon, sizei count,
boolean transpose, const oat *value);
transpose: FALSE
Shader Execuon (Validaon) [2.10.5]
void ValidateProgram(uint program);
Shader Queries
Shader Queries [6.1.8]
boolean IsShader(uint shader);
void GetShaderiv(uint shader, enum pname, int *params);
pname: SHADER_TYPE, DELETE_STATUS, COMPILE_STATUS,
INFO_LOG_LENGTH, SHADER_SOURCE_LENGTH
void GetAachedShaders(uint program, sizei maxCount,
sizei *count, uint *shaders);
void GetShaderInfoLog(uint shader, sizei bufSize,
sizei *length, char *infoLog);
void GetShaderSource(uint shader, sizei bufSize,
sizei *length, char *source);
void GetShaderPrecisionFormat(enum shadertype,
enum precisiontype, int *range, int *precision);
shadertype: VERTEX_SHADER, FRAGMENT_SHADER
precision: LOW_FLOAT, MEDIUM_FLOAT, HIGH_FLOAT, LOW_INT,
MEDIUM_INT, HIGH_INT
void GetVertexAribfv(uint index, enum pname,
oat *params);
pname: CURRENT_VERTEX_ATTRIB , VERTEX_ATTRIB_ARRAY_x
(where x may be BUFFER_BINDING, ENABLED, SIZE, STRIDE, TYPE,
NORMALIZED)
void GetVertexAribiv(uint index, enum pname,
int *params);
pname: CURRENT_VERTEX_ATTRIB , VERTEX_ATTRIB_ARRAY_x
(where x may be BUFFER_BINDING, ENABLED, SIZE, STRIDE, TYPE,
NORMALIZED)
void GetVertexAribPointerv(uint index, enum pname,
void **pointer);
pname: VERTEX_ATTRIB_ARRAY_POINTER
void GetUniformfv(uint program, int locaon,
oat *params)
void GetUniformiv(uint program, int locaon,
int *params)
Program Queries [6.1.8]
boolean IsProgram(uint program);
void GetProgramiv(uint program, enum pname, int *params);
pname: DELETE_STATUS, LINK_STATUS, VALIDATE_STATUS,
INFO_LOG_LENGTH, ATTACHED_SHADERS,
ACTIVE_ATTRIBUTES, ACTIVE_ATTRIBUTE_MAX_LENGTH,
ACTIVE_UNIFORMS, ACTIVE_UNIFORM_MAX_LENGTH
void GetProgramInfoLog(uint program, sizei bufSize,
sizei *length, char *infoLog);
Per-Fragment Operaons
Scissor Test [4.1.2]
Enable/Disable(SCISSOR_TEST)
void Scissor(int le, int boom, sizei width, sizei height );
Mulsample Fragment Operaons [4.1.3]
Enable/Disable(cap)
cap: SAMPLE_ALPHA_TO_COVERAGE, SAMPLE_COVERAGE
void SampleCoverage(clampf value, boolean invert);
Stencil Test [4.1.4]
Enable/Disable(STENCIL_TEST)
void StencilFunc(enum func, int ref, uint mask);
void StencilFuncSeparate(enum face, enum func, int ref,
uint mask);
void StencilOp(enum sfail, enum dpfail, enum dppass);
void StencilOpSeparate(enum face, enum sfail, enum dpfail,
enum dppass);
face: FRONT, BACK, FRONT_AND_BACK
sfail, dpfail, and dppass: KEEP, ZERO, REPLACE, INCR, DECR, INVERT,
INCR_WRAP, DECR_WRAP
func: NEVER, ALWAYS, LESS, LEQUAL, EQUAL, GREATER, GEQUAL,
NOTEQUAL
Depth Buer Test [4.1.5]
Enable/Disable(DEPTH_TEST)
void DepthFunc(enum func);
func: NEVER, ALWAYS, LESS, LEQUAL, EQUAL, GREATER, GEQUAL, NOTEQUAL
Blending [4.1.6]
Enable/Disable(BLEND) (applies to all draw buers)
void BlendEquaon(enum mode);
void BlendEquaonSeparate(enum modeRGB,
enum modeAlpha);
mode, modeRGB, and modeAlpha: FUNC_ADD, FUNC_SUBTRACT,
FUNC_REVERSE_SUBTRACT
void BlendFuncSeparate(enum srcRGB, enum dstRGB,
enum srcAlpha, enum dstAlpha);
void BlendFunc(enum src, enum dst);
dst, dstRGB, and dstAlpha: ZERO, ONE, [ONE_MINUS_]SRC_COLOR,
[ONE_MINUS_]DST_COLOR, [ONE_MINUS_]SRC_ALPHA,
[ONE_MINUS_]DST_ALPHA, [ONE_MINUS_]CONSTANT_COLOR,
[ONE_MINUS_]CONSTANT_ALPHA
src, srcRGB, srcAlpha: same for dst, plus SRC_ALPHA_SATURATE
void BlendColor(clampf red, clampf green, clampf blue, clampf alpha);
Dithering [4.1.7]
Enable/Disable(DITHER)
Whole Framebuer Operaons
Fine Control of Buer Updates [4.2.2]
void ColorMask(boolean r, boolean g, boolean b, boolean a);
void DepthMask(boolean mask);
void StencilMask(uint mask);
void StencilMaskSeparate(enum face, uint mask);
face: FRONT, BACK, FRONT_AND_BACK
Clearing the Buers [4.2.3]
void Clear(biield buf);
buf: Bitwise OR of COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT,
STENCIL_BUFFER_BIT
void ClearColor(clampf r, clampf g, clampf b, clampf a);
void ClearDepthf(clampf d);
void ClearStencil(int s);
State and State Requests
A complete list of symbolic constants for
states is shown in the tables in [6.2].
Simple Queries [6.1.1]
void GetBooleanv(enum value,
boolean *data);
void GetIntegerv(enum value, int *data);
void GetFloatv(enum value, oat *data);
boolean IsEnabled(enum value);
Pointer and String Queries [6.1.5]
ubyte *GetString(enum name);
name: VENDOR, RENDERER, VERSION,
SHADING_LANGUAGE_VERSION,
EXTENSIONS
Special Funcons
Flush and Finish [5.1]
Flush guarantees that commands issued so
far will eventually complete. Finish blocks
unl all commands issued so far have
completed.
void Flush(void);
void Finish(void);
Hints [5.2]
Hint controls certain aspects of GL behavior.
void Hint(enum target, enum hint);
target: GENERATE_MIPMAP_HINT
hint: FASTEST, NICEST, DONT_CARE
Framebuer Objects
Binding & Managing Framebuer Objects [4.4.1]
void BindFramebuer(enum target, uint framebuer);
target: FRAMEBUFFER
void DeleteFramebuers(sizei n, uint *framebuers);
void GenFramebuers(sizei n, uint *framebuers);
Renderbuer Objects [4.4.2]
void BindRenderbuer(enum target, uint renderbuer);
target: RENDERBUFFER
void DeleteRenderbuers(sizei n, const uint *renderbuers);
void GenRenderbuers(sizei n, uint *renderbuers);
void RenderbuerStorage(enum target,
enum internalformat, sizei width, sizei height);
target: RENDERBUFFER
internalformat: DEPTH_COMPONENT16, RGBA4, RGB5_A1,
RGB565, STENCIL_INDEX8
Aaching Renderbuer Images to Framebuer
void FramebuerRenderbuer(enum target,
enum aachment, enum renderbuertarget,
uint renderbuer);
target: FRAMEBUFFER
aachment: COLOR_ATTACHMENT0, DEPTH_ATTACHMENT,
STENCIL_ATTACHMENT
renderbuertarget: RENDERBUFFER
Aaching Texture Images to a Framebuer
void FramebuerTexture2D(enum target,
enum aachment, enum textarget, uint texture,
int level);
textarget: TEXTURE_2D, TEXTURE_CUBE_MAP_POSITIVE{X, Y, Z},
TEXTURE_CUBE_MAP_NEGATIVE{X, Y, Z},
target: FRAMEBUFFER
aachment: COLOR_ATTACHMENT0, DEPTH_ATTACHMENT,
STENCIL_ATTACHMENT
Framebuer Completeness [4.4.5]
enum CheckFramebuerStatus(enum target);
target: FRAMEBUFFER
returns: FRAMEBUFFER_COMPLETE or a constant indicang which
value violates framebuer completeness
Framebuer Object Queries [6.1.3, 6.1.7]
boolean IsFramebuer(uint framebuer);
void GetFramebuerAachmentParameteriv(enum target,
enum aachment, enum pname, int *params);
target: FRAMEBUFFER
aachment: COLOR_ATTACHMENT0, DEPTH_ATTACHMENT,
STENCIL_ATTACHMENT
pname: FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL,
FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE
Renderbuer Object Queries [6.1.3, 6.1.7]
boolean IsRenderbuer(uint renderbuer);
void GetRenderbuerParameteriv(enum target,
enum pname, int *params);
target: RENDERBUFFER
pname: RENDERBUFFER_x (where x may be WIDTH, HEIGHT,
RED_SIZE, GREEN_SIZE, BLUE_SIZE, ALPHA_SIZE, DEPTH_SIZE,
STENCIL_SIZE, INTERNAL_FORMAT)
www.khronos.org/opengles
©2010 Khronos Group - Rev. 0210