0% found this document useful (0 votes)
122 views

Opengl44 Quick Reference Card

This document provides a reference for the OpenGL 4.4 API. It lists OpenGL commands, types, and functions organized by topic. The reference card gives brief descriptions and syntax for many OpenGL operations.

Uploaded by

Stevan Milosevic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

Opengl44 Quick Reference Card

This document provides a reference for the OpenGL 4.4 API. It lists OpenGL commands, types, and functions organized by topic. The reference card gives brief descriptions and syntax for many OpenGL operations.

Uploaded by

Stevan Milosevic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

www.opengl.org/registry 2013 Khronos Group - Rev.

0713
OpenGL 4.4 API Reference Card Page 1

OpenGL Operaton
Floatng-Point Numbers [2.3.3]
16-Bit
1-bit sign, 5-bit exponent,
10-bit mantssa
Unsigned 11-Bit
no sign bit, 5-bit exponent,
6-bit mantssa
Unsigned 10-Bit
no sign bit, 5-bit exponent,
5-bit mantssa
Command Leters [Tables 2.1, 2.2]
Where a leter from the table below is used to
denote type in a functon name, T within the
prototype is the same type.
b - byte (8 bits) ub - ubyte (8 bits)
s - short (16 bits) us - ushort (16 bits)
i - int (32 bits) ui - uint (32 bits)
i64 - int64 (64 bits) ui64 - uint64 (64 bits)
f - foat (32 bits) d - double (64 bits)
OpenGL

is the only cross-platorm graphics API that enables developers of


sofware for PC, workstaton, and supercomputng hardware to create high-
performance, visually-compelling graphics sofware applicatons, in markets
such as CAD, content creaton, energy, entertainment, game development,
manufacturing, medical, and virtual reality. Specifcatons are available at
www.opengl.org/registry
see FunctonName refers to functons on this reference card.
[n.n.n] and [Table n.n] refer to sectons and tables in the OpenGL 4.4 core specifcaton.
[n.n.n] refers to sectons in the OpenGL Shading Language 4.40 specifcaton.
OpenGL Command Syntax [2.2]
GL commands are formed from a return type, a name, and optonally up to 4 characters
(or character pairs) from the Command Leters table (to the lef), as shown by the prototype:
return-type Name{1234}{b s i i64 f d ub us ui ui64}{v} ([args ,] T arg1 , . . . , T argN [, args]);
The arguments enclosed in brackets ([args ,] and [, args]) may or may not be present.
The argument type T and the number N of arguments may be indicated by the command name
sufxes. N is 1, 2, 3, or 4 if present. If v is present, an array of N items is passed by a pointer.
For brevity, the OpenGL documentaton and this reference may omit the standard prefxes.
The actual names are of the forms: glFunctonName(), GL_CONSTANT, GLtype
OpenGL Errors [2.3.1]
enum GetError(void); Returns the numeric error code.
Shaders and Programs
Shader Objects [7.1-2]
uint CreateShader(enum type);
type:
{COMPUTE, FRAGMENT}_SHADER,
{GEOMETRY, VERTEX}_SHADER,
TESS_{EVALUATION, CONTROL}_SHADER
void ShaderSource(uint shader, sizei count,
const char * const * string,
const int *length);
void CompileShader(uint shader);
void ReleaseShaderCompiler(void);
void DeleteShader(uint shader);
boolean IsShader(uint shader);
void ShaderBinary(sizei count,
const uint *shaders, enum binaryformat,
const void *binary, sizei length);
Program Objects [7.3]
uint CreateProgram(void);
void AtachShader(uint program, uint shader);
void DetachShader(uint program,
uint shader);
void LinkProgram(uint program);
void UseProgram(uint program);
uint CreateShaderProgramv(enum type,
sizei count, const char * const * strings);
void ProgramParameteri(uint program,
enum pname, int value);
pname: PROGRAM_SEPARABLE,
PROGRAM_BINARY_RETRIEVABLE_HINT
value: TRUE, FALSE
void DeleteProgram(uint program);
boolean IsProgram(uint program);
Program Interfaces [7.3.1]
void GetProgramInterfaceiv(uint program,
enum programInterface, enum pname,
int *params);
programInterface:
ATOMIC_COUNTER_BUFFER, BUFFER_VARIABLE,
UNIFORM[_BLOCK], PROGRAM_{INPUT, OUTPUT},
SHADER_STORAGE_BLOCK,
{GEOMETRY, VERTEX}_SUBROUTINE,
TESS_{CONTROL, EVALUATION}_SUBROUTINE,
{FRAGMENT, COMPUTE}_SUBROUTINE,
TESS_CONTROL_SUBROUTINE_UNIFORM,
TESS_EVALUATION_SUBROUTINE_UNIFORM,
{GEOMETRY, VERTEX}_SUBROUTINE_UNIFORM,
{FRAGMENT, COMPUTE}_SUBROUTINE_UNIFORM,
TRANSFORM_FEEDBACK_{BUFFER, VARYING}
pname: ACTIVE_RESOURCES, MAX_NAME_LENGTH,
MAX_NUM_ACTIVE_VARIABLES,
MAX_NUM_COMPATIBLE_SUBROUTINES
uint GetProgramResourceIndex(
uint program, enum programInterface,
const char *name);
void GetProgramResourceName(
uint program, enum programInterface,
uint index, sizei bufSize, sizei *length,
char *name);
void GetProgramResourceiv(uint program,
enum programInterface, uint index,
sizei propCount, const enum *props,
sizei bufSize, sizei *length, int *params);
*props: [see Table 7.2]
int GetProgramResourceLocaton(
uint program, enum programInterface,
const char *name);
int GetProgramResourceLocatonIndex(
uint program, enum programInterface,
const char *name);
(Contnued on next page >)
Synchronizaton
Flush and Finish [2.3.2]
void Flush(void);
void Finish(void);
Sync Objects and Fences [4.1]
void DeleteSync(sync sync);
sync FenceSync(enum conditon,
bitield fags);
conditon: SYNC_GPU_COMMANDS_COMPLETE
fags: must be 0
boolean IsSync(sync sync);
Waitng for Sync Objects [4.1.1]
enum ClientWaitSync(sync sync,
bitield fags, uint64 tmeout_ns);
fags: SYNC_FLUSH_COMMANDS_BIT, or zero
void WaitSync(sync sync, bitield fags,
uint64 tmeout);
tmeout: TIMEOUT_IGNORED
Sync Object Queries [4.1.3]
void GetSynciv(sync sync, enum pname,
sizei bufSize, sizei *length, int *values);
pname: OBJECT_TYPE,
SYNC_{STATUS, CONDITION, FLAGS}
Timer Queries [4.3]
Timer queries use query objects to track the
amount of tme needed to fully complete a set
of GL commands.
void QueryCounter(uint id, TIMESTAMP);
void GetInteger64v(TIMESTAMP, int64 *data);
Asynchronous Queries [4.2, 4.2.1]
void GenQueries(sizei n, uint *ids);
void DeleteQueries(sizei n, const uint *ids);
void BeginQuery(enum target, uint id);
target: ANY_SAMPLES_PASSED[_CONSERVATIVE],
PRIMITIVES_GENERATED,
SAMPLES_PASSED, TIME_ELAPSED,
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN
void BeginQueryIndexed(enum target,
uint index, uint id);
target: see BeginQuery
void EndQuery(enum target);
void EndQueryIndexed(enum target,
uint index);
boolean IsQuery(uint id);
void GetQueryiv(enum target, enum pname,
int *params);
target: see BeginQuery, plus TIMESTAMP
pname: CURRENT_QUERY, QUERY_COUNTER_BITS
void GetQueryIndexediv(enum target,
uint index, enum pname, int *params);
target: see BeginQuery
pname: CURRENT_QUERY,
QUERY_COUNTER_BITS
void GetQueryObjectv(uint id,
enum pname, int *params);
void GetQueryObjectuiv(uint id,
enum pname, uint *params);
void GetQueryObject64v(uint id,
enum pname, int64 *params);
void GetQueryObjectui64v(uint id,
enum pname, uint64 *params);
pname: QUERY_RESULT{_AVAILABLE},
QUERY_RESULT_NO_WAIT
Bufer Objects [6]
void GenBufers(sizei n, uint *bufers);
void DeleteBufers(sizei n,
const uint *bufers);
Create and Bind Bufer Objects[6.1]
void BindBufer(enum target, uint bufer);
target: [Table 6.1] {ARRAY, UNIFORM}_BUFFER,
ATOMIC_COUNTER_BUFFER,
COPY_{READ, WRITE}_BUFFER,
{DISPATCH, DRAW}_INDIRECT_BUFFER,
ELEMENT_ARRAY_BUFFER,
PIXEL_[UN]PACK_BUFFER,
{QUERY, TEXTURE}_BUFFER,
SHADER_STORAGE_BUFFER,
TRANSFORM_FEEDBACK_BUFFER
void BindBuferRange(enum target,
uint index, uint bufer, intptr ofset,
sizeiptr size);
target: ATOMIC_COUNTER_BUFFER,
{SHADER_STORAGE, UNIFORM}_BUFFER,
TRANSFORM_FEEDBACK_BUFFER
void BindBuferBase(enum target,
uint index, uint bufer);
target: see BindBuferRange
void BindBufersRange(enum target,
uint frst, sizei count, const uint *bufers,
const intptr *ofsets, const sizeiptr *size);
target: see BindBuferRange
void BindBufersBase(enum target,
uint frst, sizei count, const uint *bufers);
target: see BindBuferRange
Create, Modify Bufer Object Data [6.2]
void BuferStorage(enum target,
sizeiptr size, const void *data,
bitield fags);
target: see BindBufer
fags: Bitwise OR of MAP_{READ, WRITE}_BIT,
{DYNAMIC, CLIENT}_STORAGE_BIT,
MAP_{COHERENT, PERSISTENT}_BIT
void BuferData(enum target, sizeiptr size,
const void *data, enum usage);
target: see BindBufer
usage: DYNAMIC_{DRAW, READ, COPY},
STATIC_{DRAW, READ, COPY},
STREAM_{DRAW, READ, COPY}
void BuferSubData(enum target,
intptr ofset, sizeiptr size,
const void *data);
target: see BindBufer
void ClearBuferSubData(enum target,
enum internalFormat, intptr ofset,
sizeiptr size, enum format, enum type,
const void *data);
target: see BindBufer
internalformat: see TexBufer on pg. 3 of this card
format: RED, GREEN, BLUE, RG, RGB, RGBA, BGR,
BGRA,{RED, GREEN, BLUE, RG, RGB}_INTEGER,
{RGBA, BGR, BGRA} _INTEGER, STENCIL_INDEX,
DEPTH_{COMPONENT, STENCIL}
void ClearBuferData(enum target,
enum internalformat, enum format,
enum type, const void *data);
target, internalformat, format: see
ClearBuferSubData
Map/Unmap Bufer Data [6.3]
void *MapBuferRange(enum target,
intptr ofset, sizeiptr length,
bitield access);
access: The logical OR of MAP_X_BIT, where X may
be READ, WRITE, PERSISTENT, COHERENT,
INVALIDATE_{BUFFER, RANGE},
FLUSH_EXPLICIT, UNSYNCHRONIZED
target: see BindBufer
void *MapBufer(enum target,
enum access);
access: see MapBuferRange
void FlushMappedBuferRange(
enum target, intptr ofset, sizeiptr length);
target: see BindBufer
boolean UnmapBufer(enum target);
target: see BindBufer
Invalidate Bufer Data [6.5]
void InvalidateBuferSubData(uint bufer,
intptr ofset, sizeiptr length);
void InvalidateBuferData(uint bufer);
Copy Between Bufers [6.6]
void CopyBuferSubData(enum readtarget,
enum writetarget, intptr readofset,
intptr writeofset, sizeiptr size);
readtarget and writetarget: see BindBufer
Bufer Object Queries [6, 6.7]
boolean IsBufer(uint bufer);
void GetBuferParameteriv(enum target,
enum pname, int *data);
target: see BindBufer
pname: [Table 6.2] BUFFER_SIZE, BUFFER_USAGE,
BUFFER_{ACCESS[_FLAGS], BUFFER_MAPPED,
BUFFER_MAP_{OFFSET, LENGTH},
BUFFER_IMMUTABLE_STORAGE,
BUFFER_ACCESS_FLAGS
void GetBuferParameteri64v(enum target,
enum pname, int64 *data);
target: see BindBufer
pname: see GetBuferParameteriv
void GetBuferSubData(enum target,
intptr ofset, sizeiptr size, void *data);
target: see BindBufer
void GetBuferPointerv(enum target,
enum pname, const void **params);
target: see BindBufer
pname: BUFFER_MAP_POINTER
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 2 OpenGL 4.4 API Reference Card

Textures and Samplers [8]


void ActveTexture(enum texture);
texture: TEXTUREi (where i is
[0, max(MAX_TEXTURE_COORDS,
MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1])
Texture Objects [8.1]
void GenTextures(sizei n, uint *textures);
void BindTexture(enum target, uint texture);
target: TEXTURE_{1D, 2D}[_ARRAY],
TEXTURE_{3D, RECTANGLE, BUFFER},
TEXTURE_CUBE_MAP[_ARRAY],
TEXTURE_2D_MULTISAMPLE[_ARRAY]
void BindTextures(uint frst, sizei count, const
uint *textures);
target: see BindTexture
void DeleteTextures(sizei n,
const uint *textures);
boolean IsTexture(uint texture);
Sampler Objects [8.2]
void GenSamplers(sizei count, uint *samplers);
void BindSampler(uint unit, uint sampler);
void BindSamplers(uint frst, sizei count,
const uint *samplers);
void SamplerParameter{i f}(uint sampler,
enum pname, T param);
pname: TEXTURE_x where x may be WRAP_{S, T, R},
{MIN, MAG}_FILTER, {MIN, MAX}_LOD,
BORDER_COLOR, LOD_BIAS,
COMPARE_{MODE, FUNC} [Table 23.18]
void SamplerParameter{i f}v(uint sampler,
enum pname, const T *param);
pname: see SamplerParameter{if}
void SamplerParameterI{i ui}v(uint sampler,
enum pname, const T *params);
pname: see SamplerParameter{if}
void DeleteSamplers(sizei count,
const uint *samplers);
boolean IsSampler(uint sampler);
Sampler Queries [8.3]
void GetSamplerParameter{i f}v(
uint sampler, enum pname, T *params);
pname: see SamplerParameter{if}
void GetSamplerParameterI{i ui}v(
uint sampler, enum pname, T *params);
pname: see SamplerParameter{if}
Pixel Storage Modes [8.4.1]
void PixelStore{i f}(enum pname, T param);
pname: [Tables 8.1, 18.1] [UN]PACK_X where X may be
SWAP_BYTES, LSB_FIRST, ROW_LENGTH,
SKIP_{IMAGES, PIXELS, ROWS}, ALIGNMENT,
IMAGE_HEIGHT, COMPRESSED_BLOCK_WIDTH,
COMPRESSED_BLOCK_{HEIGHT, DEPTH, SIZE}
Texture Image Spec. [8.5]
void TexImage3D(enum target, int level,
int internalformat, sizei width, sizei height,
sizei depth, int border, enum format,
enum type, const void *data);
target: [PROXY_]TEXTURE_CUBE_MAP_ARRAY,
[PROXY_]TEXTURE_3D, [PROXY_]TEXTURE_2D_ARRAY
internalformat: STENCIL_INDEX, RED,
DEPTH_{COMPONENT, STENCIL}, RG, RGB, RGBA,
COMPRESSED_{RED, RG, RGB, RGBA, SRGB,
SRGB_ALPHA), a sized internal format from [Tables
8.12 - 8.13], or a specifc compressed format in
[Table 8.14]
format: DEPTH_{COMPONENT, STENCIL}, RED,
GREEN, BLUE, RG, RGB, RGBA, BGR, BGRA,
{BGRA, RED, GREEN, BLUE}_INTEGER,
{RG, RGB, RGBA, BGR}_INTEGER,
STENCIL_INDEX, [Table 8.3]
type: [UNSIGNED_]{BYTE, SHORT, INT},
[HALF_]FLOAT, or a value from [Table 8.2]
void TexImage2D(enum target, int level,
int internalformat, sizei width,
sizei height, int border, enum format,
enum type, const void *data);
target: [PROXY_]TEXTURE_{2D, RECTANGLE},
[PROXY_]TEXTURE_1D_ARRAY,
PROXY_TEXTURE_CUBE_MAP
TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z},
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z}
internalformat, format, type: see TexImage3D
void TexImage1D(enum target, int level,
int internalformat, sizei width, int border,
enum format, enum type,
const void *data);
target: TEXTURE_1D, PROXY_TEXTURE_1D
type, internalformat, format: see TexImage3D
Alternate Texture Image Spec. [8.6]
void CopyTexImage2D(enum target,
int level, enum internalformat, int x,
int y, sizei width, sizei height, int border);
target: TEXTURE_{2D, RECTANGLE, 1D_ARRAY},
TEXTURE_CUBE_MAP_{POSITIVE, NEGATIVE}_{X, Y, Z}
internalformat: see TexImage3D
void CopyTexImage1D(enum target,
int level, enum internalformat, int x,
int y, sizei width, int border);
target: TEXTURE_1D
internalformat: see TexImage3D
void TexSubImage3D(enum target, int level,
int xofset, int yofset, int zofset,
sizei width, sizei height, sizei depth,
enum format, enum type,
const void *data);
target: TEXTURE_3D, TEXTURE_2D_ARRAY,
TEXTURE_CUBE_MAP_ARRAY
format, type: see TexImage3D
void TexSubImage2D(enum target, int level,
int xofset, int yofset, sizei width,
sizei height, enum format, enum type,
const void *data);
target: see CopyTexImage2D
format, type: see TexImage3D
void TexSubImage1D(enum target, int level,
int xofset, sizei width, enum format,
enum type, const void *data);
target: TEXTURE_1D
format, type: see TexImage3D
void CopyTexSubImage3D(enum target,
int level, int xofset, int yofset, int zofset,
int x, int y, sizei width, sizei height);
target: see TexSubImage3D
void CopyTexSubImage2D(enum target,
int level, int xofset, int yofset, int x,
int y, sizei width, sizei height);
target: see TexImage2D
(Contnued on next page >)
Shaders and Programs (cont.)
Program Pipeline Objects [7.4]
void GenProgramPipelines(sizei n,
uint *pipelines);
void DeleteProgramPipelines(sizei n,
const uint *pipelines);
boolean IsProgramPipeline(uint pipeline);
void BindProgramPipeline(uint pipeline);
void UseProgramStages(uint pipeline,
bitield stages, uint program);
stages: ALL_SHADER_BITS or the bitwise OR of
TESS_{CONTROL, EVALUATION}_SHADER_BIT,
{VERTEX, GEOMETRY, FRAGMENT}_SHADER_BIT,
COMPUTE_SHADER_BIT
void ActveShaderProgram(uint pipeline,
uint program);
Program Binaries [7.5]
void GetProgramBinary(uint program,
sizei bufSize, sizei *length,
enum *binaryFormat, void *binary);
void ProgramBinary(uint program,
enum binaryFormat, const void *binary,
sizei length);
Uniform Variables [7.6]
int GetUniformLocaton(uint program,
const char *name);
void GetActveUniformName(uint program,
uint uniformIndex, sizei bufSize,
sizei *length, char *uniformName);
void GetUniformIndices(uint program,
sizei uniformCount,
const char **uniformNames,
uint *uniformIndices);
void GetActveUniform(uint program,
uint index, sizei bufSize, sizei *length,
int *size, enum *type, char *name);
*type returns: DOUBLE_{VECn, MATn, MATmxn},
DOUBLE, FLOAT_{VECn, MATn, MATmxn}, FLOAT,
INT, INT_VECn, UNSIGNED_INT{_VECn}, BOOL,
BOOL_VECn, or any value in [Table 7.3]
void GetActveUniformsiv(uint program,
sizei uniformCount,
const uint *uniformIndices, enum pname,
int *params);
pname: [Table 7.6] UNIFORM_{NAME_LENGTH, TYPE},
UNIFORM_{SIZE, BLOCK_INDEX, UNIFORM_OFFSET},
UNIFORM_{ARRAY, MATRIX}_STRIDE,
UNIFORM_IS_ROW_MAJOR,
UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX
uint GetUniformBlockIndex(uint program,
const char *uniformBlockName);
void GetActveUniformBlockName(
uint program, uint uniformBlockIndex,
sizei bufSize, sizei length,
char *uniformBlockName);
void GetActveUniformBlockiv(
uint program, uint uniformBlockIndex,
enum pname, int *params);
pname: UNIFORM_BLOCK_{BINDING, DATA_SIZE},
UNIFORM_BLOCK_NAME_LENGTH,
UNIFORM_BLOCK_ACTIVE_UNIFORMS[_INDICES],
UNIFORM_BLOCK_REFERENCED_BY_X_SHADER,
where X may be one of VERTEX, FRAGMENT,
COMPUTE, GEOMETRY, TESS_CONTROL, or
TESS_EVALUATION [Table 7.7]
void GetActveAtomicCounterBuferiv(
uint program, uint buferIndex,
enum pname, int *params);
pname: see GetActveUniformBlockiv, however
replace the prefx UNIFORM_BLOCK_ with
ATOMIC_COUNTER_BUFFER_
Load Uniform Vars. In Default Uniform Block
void Uniform{1234}{i f d ui}(int locaton,
T value);
void Uniform{1234}{i f d ui}v(int locaton,
sizei count, const T *value);
void UniformMatrix{234}{f d}v(
int locaton, sizei count, boolean transpose,
const foat *value);
void UniformMatrix{2x3,3x2,2x4,4x2,3x4,
4x3}{fd}v(int locaton, sizei count,
boolean transpose, const foat *value);
void ProgramUniform{1234}{i f d}(
uint program, int locaton, T value);
void ProgramUniform{1234}{i f d}v(
uint program, int locaton, sizei count,
const T *value);
void ProgramUniform{1234}uiv(
uint program, int locaton, sizei count,
const T *value);
void ProgramUniform{1234}ui(
uint program, int locaton, T value);
void ProgramUniformMatrix{234}{f d}v(
uint program, int locaton, sizei count,
boolean transpose, const T *value);
void ProgramUniformMatrixf{2x3,3x2,2x4,
4x2, 3x4, 4x3}{f d}v(
uint program, int locaton, sizei count,
boolean transpose, const T *value);
Uniform Bufer Object Bindings
void UniformBlockBinding(uint program,
uint uniformBlockIndex,
uint uniformBlockBinding);
Shader Bufer Variables [7.8]
void ShaderStorageBlockBinding(
uint program, uint storageBlockIndex,
uint storageBlockBinding);
Subroutne Uniform Variables [7.9]
Parameter shadertype for the functons in this
secton may be one of
TESS_{CONTROL, EVALUATION}_SHADER,
{COMPUTE, VERTEX}_SHADER,
{FRAGMENT, GEOMETRY}_SHADER
int GetSubroutneUniformLocaton(
uint program, enum shadertype,
const char *name);
uint GetSubroutneIndex(uint program,
enum shadertype, const char *name);
void GetActveSubroutneName(
uint program, enum shadertype,
uint index, sizei bufsize, sizei *length,
char *name);
void GetActveSubroutneUniformName(
uint program, enum shadertype,
uint index, sizei bufsize, sizei *length,
char *name);
void GetActveSubroutneUniformiv(
uint program, enum shadertype,
uint index, enum pname, int *values);
pname: [NUM_]COMPATIBLE_SUBROUTINES
void UniformSubroutnesuiv(
enum shadertype, sizei count,
const uint *indices);
Shader Memory Access [7.12.2]
See diagram on page 6 for more informaton.
void MemoryBarrier(bitield barriers);
barriers: ALL_BARRIER_BITS or the OR of
X_BARRIER_BIT where X may be:
VERTEX_ATTRIB_ARRAY, ELEMENT_ARRAY,
UNIFORM, TEXTURE_FETCH, BUFFER_UPDATE,
SHADER_IMAGE_ACCESS, COMMAND,
PIXEL_BUFFER, TEXTURE_UPDATE, FRAMEBUFFER,
TRANSFORM_FEEDBACK, ATOMIC_COUNTER,
SHADER_STORAGE, CLIENT_MAPPED_BUFFER,
QUERY_BUFFER
Shader|Program Queries [7.13]
void GetShaderiv(uint shader, enum pname,
int *params);
pname: SHADER_TYPE, INFO_LOG_LENGTH, {DELETE,
COMPILE}_STATUS, COMPUTE_SHADER, SHADER_
SOURCE_LENGTH
void GetProgramiv(uint program,
enum pname, int *params);
pname: ACTIVE_ATOMIC_COUNTER_BUFFERS,
ACTIVE_ATTRIBUTES,
ACTIVE_ATTRIBUTE_MAX_LENGTH,
ACTIVE_UNIFORMS, ACTIVE_UNIFORM_BLOCKS,
ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH,
ACTIVE_UNIFORM_MAX_LENGTH,
ATTACHED_SHADERS,
COMPUTE_WORK_GROUP_SIZE, DELETE_STATUS,
GEOMETRY_{INPUT, OUTPUT}_TYPE,
GEOMETRY_SHADER_INVOCATIONS,
GEOMETRY_VERTICES_OUT, INFO_LOG_LENGTH,
LINK_STATUS, PROGRAM_SEPARABLE,
PROGRAM_BINARY_RETRIEVABLE_HINT,
TESS_CONTROL_OUTPUT_VERTICES,
TESS_GEN_{MODE, SPACING},
TESS_GEN_{VERTEX_ORDER, POINT_MODE},
TRANSFORM_FEEDBACK_BUFFER_MODE,
TRANSFORM_FEEDBACK_VARYINGS,
TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH,
VALIDATE_STATUS
void GetProgramPipelineiv(uint pipeline,
enum pname, int *params);
pname: ACTIVE_PROGRAM, VALIDATE_STATUS,
{VERTEX, FRAGMENT, GEOMETRY}_SHADER,
TESS_{CONTROL, EVALUATION}_SHADER,
INFO_LOG_LENGTH, COMPUTE_SHADER
void GetAtachedShaders(uint program,
sizei maxCount, sizei *count,
uint *shaders);
void GetShaderInfoLog(uint shader,
sizei bufSize, sizei *length, char *infoLog);
void GetProgramInfoLog(uint program,
sizei bufSize, sizei *length, char *infoLog);
void GetProgramPipelineInfoLog(
uint pipeline, 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, FRAGMENT}_SHADER
precisiontype: {LOW, MEDIUM, HIGH}_{FLOAT, INT}
void GetUniform{f d i ui}v(uint program,
int locaton, T *params);
void GetUniformSubroutneuiv(
enum shadertype, int locaton,
uint *params);
void GetProgramStageiv(uint program,
enum shadertype, enum pname,
int *values);
pname: ACTIVE_SUBROUTINES,
ACTIVE_SUBROUTINES_X where X may be
UNIFORMS, MAX_LENGTH, UNIFORM_LOCATIONS,
UNIFORM_MAX_LENGTH
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
OpenGL 4.4 API Reference Card Page 3

Framebufer Objects
Binding and Managing [9.2]
void BindFramebufer(enum target,
uint framebufer);
target: [DRAW_, READ_]FRAMEBUFFER
void GenFramebufers(sizei n,
uint *framebufers);
void DeleteFramebufers(sizei n,
const uint *framebufers);
boolean IsFramebufer(uint framebufer);
Framebufer Object Parameters [9.2.1]
void FramebuferParameteri(
enum target, enum pname, int param);
target: [DRAW_, READ_]FRAMEBUFFER
pname: FRAMEBUFFER_DEFAULT_X where X may be
WIDTH, HEIGHT, FIXED_SAMPLE_LOCATIONS,
SAMPLES, LAYERS
Framebufer Object Queries [9.2.3]
void GetFramebuferParameteriv(
enum target, enum pname, int *params);
target, pname: see FramebuferParameteri
void GetFramebuferAtachmentParameteriv(
enum target, enum atachment,
enum pname, int *params);
target: [DRAW_, READ_]FRAMEBUFFER
atachment: DEPTH, FRONT_{LEFT, RIGHT}, STENCIL,
BACK_{LEFT, RIGHT}, COLOR_ATTACHMENTi,
{DEPTH, STENCIL, DEPTH_STENCIL}_ATTACHMENT
pname: FRAMEBUFFER_ATTACHMENT_ X where X
may be OBJECT_{TYPE, NAME},
COMPONENT_TYPE, {RED, GREEN, BLUE}_SIZE,
{ALPHA, DEPTH, STENCIL}_SIZE,
COLOR_ENCODING, TEXTURE_{LAYER, LEVEL},
LAYERED, TEXTURE_CUBE_MAP_FACE
Ataching Images [9.2.4]
void BindRenderbufer(enum target,
uint renderbufer);
target: RENDERBUFFER
void GenRenderbufers(sizei n,
uint *renderbufers);
void DeleteRenderbufers(sizei n,
const uint *renderbufers);
boolean IsRenderbufer(uint renderbufer);
void RenderbuferStorageMultsample(
enum target, sizei samples,
enum internalformat, sizei width,
sizei height);
target: RENDERBUFFER
internalformat: see TexImage3DMultsample
void RenderbuferStorage(enum target,
enum internalformat, sizei width,
sizei height);
target: RENDERBUFFER
internalformat: see TexImage3DMultsample
Renderbufer Object Queries [9.2.6]
void GetRenderbuferParameteriv(
enum target, enum pname, int *params);
target: RENDERBUFFER
pname: [Table 23.27]
RENDERBUFFER_X where X may be WIDTH,
HEIGHT, INTERNAL_FORMAT, SAMPLES,
{RED, GREEN, BLUE, ALPHA, DEPTH, STENCIL}_SIZE
Ataching Renderbufer Images [9.2.7]
void FramebuferRenderbufer(
enum target, enum atachment,
enum renderbufertarget,
uint renderbufer);
target: [DRAW_, READ_]FRAMEBUFFER
atachment: [Table 9.2]
{DEPTH, STENCIL, DEPTH_STENCIL}_ATTACHMENT,
COLOR_ATTACHMENTi where i is
[0, MAX_COLOR_ATTACHMENTS - 1]
renderbufertarget: RENDERBUFFER
Ataching Texture Images [9.2.8]
void FramebuferTexture(enum target,
enum atachment, uint texture, int level);
target: [DRAW_, READ_]FRAMEBUFFER
atachment: see FramebuferRenderbufer
void FramebuferTexture1D(enum target,
enum atachment, enum textarget,
uint texture, int level);
textarget: TEXTURE_1D
target, atachment: see FramebuferRenderbufer
void FramebuferTexture2D(enum target,
enum atachment, enum textarget,
uint texture, int level);
textarget: TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z},
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
TEXTURE_{2D, RECTANGLE, 2D_MULTISAMPLE}
target, atachment: see FramebuferRenderbufer
void FramebuferTexture3D(enum target,
enum atachment, enum textarget,
uint texture, int level, int layer);
textarget: TEXTURE_3D
target, atachment: see FramebuferRenderbufer
void FramebuferTextureLayer(enum target,
enum atachment, uint texture,
int level, int layer);
target, atachment: see FramebuferRenderbufer
Framebufer Completeness [9.4.2]
enum CheckFramebuferStatus(enum target);
target: [DRAW_, READ_]FRAMEBUFFER
returns: FRAMEBUFFER_COMPLETE or a constant
indicatng the violatng value
Textures and Samplers (cont.)
void CopyTexSubImage1D(enum target,
int level, int xofset, int x, int y, sizei width);
target: see TexSubImage1D
Compressed Texture Images [8.7]
void CompressedTexImage3D(enum target,
int level, enum internalformat, sizei width,
sizei height, sizei depth, int border,
sizei imageSize, const void *data);
target: see TexImage3D
internalformat: COMPRESSED_X where X may be
[SIGNED_]RED_RGTC1, [SIGNED_]RG_RGTC2,
{RGBA, SRGB_ALPHA}_BPTC_UNORM,
RGB_BPTC_{SIGNED, UNSIGNED}_FLOAT
void CompressedTexImage2D(enum target,
int level, enum internalformat,
sizei width, sizei height, int border,
sizei imageSize, const void *data);
target: see TexImage2D, omitng compressed
rectangular texture formats
internalformat: see CompressedTexImage3D,
plus COMPRESSED_X where X may be
{RGB8, SRGB8}_ETC2,
{RGB8, SRGB8}_PUNCHTHROUGH_ALPHA1_ETC2,
{RGBA8, SRGB8_ALPHA8}_ETC2_EAC,
[SIGNED_]R11_EAC, [SIGNED_]RG11_EAC
void CompressedTexImage1D(enum target,
int level, enum internalformat,
sizei width, int border, sizei imageSize,
const void *data);
target: TEXTURE_1D, PROXY_TEXTURE_1D
void CompressedTexSubImage3D(
enum target, int level, int xofset,
int yofset, int zofset, sizei width,
sizei height, sizei depth, enum format,
sizei imageSize, const void *data);
target: see TexSubImage3D
format: see internalformat for
CompressedTexImage3D
void CompressedTexSubImage2D(
enum target, int level, int xofset,
int yofset, sizei width, sizei height,
enum format, sizei imageSize,
cont void *data);
target: see TexSubImage2D
format: see internalformat for
CompressedTexImage2D
void CompressedTexSubImage1D(
enum target, int level, int xofset,
sizei width, enum format, sizei imageSize,
const void *data);
target: see TexSubImage1D
format: see internalformat for
CompressedTexImage1D
Multsample Textures [8.8]
void TexImage3DMultsample(enum target,
sizei samples, int internalformat,
sizei width, sizei height, sizei depth,
boolean fxedsamplelocatons);
target: [PROXY_]TEXTURE_2D_MULTISAMPLE_ARRAY
internalformat: RED, RG, RGB, RGBA,
STENCIL_INDEX, DEPTH_{COMPONENT, STENCIL},
or sized internal formats corresponding to these
base formats
void TexImage2DMultsample(enum target,
sizei samples, int internalformat,
sizei width, sizei height,
boolean fxedsamplelocatons);
target: [PROXY_]TEXTURE_2D_MULTISAMPLE
internalformat: see TexImage3DMultsample
Bufer Textures [8.9]
void TexBuferRange(enum target,
enum internalFormat, uint bufer,
intptr ofset, sizeiptr size);
void TexBufer(enum target,
enum internalformat, uint bufer);
target: TEXTURE_BUFFER
internalformat: [Table 8.15] R8, R8{I, UI}, R16,
R16{F, I, UI}, R32{F, I, UI}, RG8, RG8{I, UI}, RG16,
RG16{F, I, UI}, RG32{F, I, UI}, RGB32F, RGB32{I, UI},
RGBA8, RGBA8{I, UI}, RGBA16, RGBA16{F, I, UI},
RGBA32{F, I, UI}
Texture Parameters [8.10]
void TexParameter{i f}(enum target,
enum pname, T param);
target: see BindTexture
void TexParameter{i f}v(enum target,
enum pname, const T *params);
target: see BindTexture
void TexParameterI{i ui}v(enum target,
enum pname, const T *params);
target: see BindTexture
pname: DEPTH_STENCIL_TEXTURE_MODE or
TEXTURE_X where X may be one of
WRAP_{S, T, R}, BORDER_COLOR,
{MIN, MAG}_FILTER, LOD_BIAS,{MIN, MAX}_LOD,
{BASE, MAX}_LEVEL, SWIZZLE_{R, G, B, A, RGBA},
COMPARE_{MODE, FUNC} [Table 8.16]
Enumerated Queries [8.11]
void GetTexParameter{if}v(enum target,
enum value, T data);
target: see BindTexture
value: see GetTexParameterI
void GetTexParameterI{i ui}v(enum target,
enum value, T data);
target: see BindTexture
value: see pname for TexParameterI{i ui}v,
plus IMAGE_FORMAT_COMPATIBILITY_TYPE,
TEXTURE_IMMUTABLE_{FORMAT, LEVELS},
TEXTURE_VIEW_NUM_{LEVELS, LAYERS},
TEXTURE_VIEW_MIN_{LEVEL, LAYER} [Table 8.16]
void GetTexLevelParameter{i f}v(enum target,
int lod, enum value, T data);
target: [PROXY_]TEXTURE_{1D, 2D, 3D},
TEXTURE_BUFFER, PROXY_TEXTURE_CUBE_MAP,
[PROXY_]TEXTURE_{1D, 2D,CUBE_MAP}_ARRAY,
[PROXY_]TEXTURE_RECTANGLE,
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z},
[PROXY_]TEXTURE_2D_MULTISAMPLE[_ARRAY]
value: TEXTURE_{WIDTH, HEIGHT, DEPTH},
TEXTURE_{SAMPLES, FIXED_SAMPLE_LOCATIONS},
TEXTURE_{INTERNAL_FORMAT, SHARED_SIZE},
TEXTURE_COMPRESSED[_IMAGE_SIZE],
TEXTURE_BUFFER_DATA_STORE_BINDING,
TEXTURE_BUFFER_{OFFSET, SIZE},
TEXTURE_STENCIL_SIZE, TEXTURE_ X_{SIZE, TYPE}
where X can be RED, GREEN, BLUE, ALPHA, DEPTH
void GetTexImage(enum tex, int lod,
enum format, enum type, void *img);
tex: TEXTURE_{1, 2}D[_ARRAY],
TEXTURE_{3D, RECTANGLE, CUBE_MAP_ARRAY},
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z}
format: see ClearBuferSubData, pg 1 this card
type: [UNSIGNED_]BYTE, SHORT, INT,
[HALF_]FLOAT, or a value from [Table 8.2]
void GetCompressedTexImage(enum target,
int lod, void *img);
target: see tex for GetTexImage
Cube Map Texture Select [8.13.1]
Enable/Disable/IsEnabled(
TEXTURE_CUBE_MAP_SEAMLESS);
Manual Mipmap Generaton [8.14.4]
void GenerateMipmap(enum target);
target: TEXTURE_{1D, 2D, 3D},
TEXTURE_{1D, 2D}_ARRAY,
TEXTURE_CUBE_MAP[_ARRAY]
Texture Views [8.18]
void TextureView(uint texture, enum target,
uint origtexture, enum internalformat,
uint minlevel, uint numlevels,
uint minlayer, uint numlayers);
target: TEXTURE_{1D, 2D,CUBE_MAP}[_ARRAY],
TEXTURE_3D, TEXTURE_RECTANGLE,
TEXTURE_2D_MULTISAMPLE[_ARRAY]
internalformat: [Table 8.21] R8{UI, I}, R8[_SNORM],
RG8{F, UI, I}, RG8[_SNORM], RGB8[_SNORM],
RGBA8{UI, I}, RGBA8[_SNORM], SRGB8[UI, I],
SRGB8_ALPHA8, RGB9_E5, RGB10_A2[UI],
R11F_G11F_B10F, RGBA16{F, UI, I},
RGBA16[_SNORM], RGB16{F, UI, I},
RGB16[_SNORM], RG16{F, UI, I}, RG16[_SNORM],
R16{F, UI, I}, R16[_SNORM], RGBA32{F, UI, I},
RGB32{F, UI, I} , RG32{F, UI, I}, R32{F, UI, I};
COMPRESSED_X where X may be
[SIGNED]_RED_RGTC1, [SIGNED]_RG_RGTC2,
{RGBA, SRGB_ALPHA}_BPTC_UNORM,
RGB_BPTC_[UN]SIGNED_FLOAT
Immutable-Format Tex. Images [8.19]
void TexStorage1D(enum target, sizei levels,
enum internalformat, sizei width);
target: TEXTURE_1D, PROXY_TEXTURE_1D
internalformat: any of the sized internal color, depth,
and stencil formats in [Tables 8.18-20]
void TexStorage2D(enum target,
sizei levels, enum internalformat,
sizei width, sizei height);
target: [PROXY_]TEXTURE_{RECTANGLE, CUBE_MAP},
[PROXY_]TEXTURE_{1D_ARRAY, 2D}
internalformat: see TexStorage1D
void TexStorage3D(enum target,
sizei levels, enum internalformat,
sizei width, sizei height, sizei depth);
target: TEXTURE_3D, PROXY_TEXTURE_3D,
[PROXY_]TEXTURE_{CUBE_MAP, 2D}[_ARRAY]
internalformat: see TexStorage1D
void TexStorage2DMultsample(
enum target, sizei samples,
enum internalformat, sizei width,
sizei height, boolean fxedsamplelocatons);
target: [PROXY_]TEXTURE_2D_MULTISAMPLE
void TexStorage3DMultsample(
enum target, sizei samples,
enum internalformat, sizei width,
sizei height, sizei depth,
boolean fxedsamplelocatons);
target: [PROXY_]TEXTURE_2D_MULTISAMPLE_ARRAY
Invalidate Texture Image Data [8.20]
void InvalidateTexSubImage(uint texture,
int level, int xofset, int yofset, int zofset,
sizei width, sizei height, sizei depth);
void InvalidateTexImage(uint texture,
int level);
Clear Texture Image Data [8.21]
void ClearTexSubImage(uint texture,
int level, int xofset, int yofset, int zofset,
sizei width, sizei height, sizei depth,
enum format, enum type,
const void *data);
format, type: see TexImage3D, pg 2 this card
void ClearTexImage(uint texture, int level,
enum format, enum type,
const void *data);
format, type: see TexImage3D, pg 2 this card
Texture Image Loads/Stores [8.26]
void BindImageTexture(uint index,
uint texture, int level, boolean layered,
int layer, enum access, enum format);
access: READ_ONLY, WRITE_ONLY, READ_WRITE
format: RGBA{32,16}F, RG{32,16}F, R11F_G11F_B10F,
R{32,16}F, RGBA{32,16,8}UI, RGB10_A2UI,
RG{32,16,8}UI, R{32,16,8}UI, RGBA{32,16,8}I,
RG{32,16,8}I, R{32,16,8}I, RGBA{16,8}, RGB10_A2,
RG{16,8}, R{16,8}, RGBA{16,8}_SNORM,
RG{16,8}_SNORM, R{16,8}_SNORM [Table 8.25]
void BindImageTextures(uint frst,
sizei count, const uint *textures);
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 4 OpenGL 4.4 API Reference Card

Vertex Post-Processing [13]


Transform Feedback [13.2]
void GenTransformFeedbacks(sizei n,
uint *ids);
void DeleteTransformFeedbacks(sizei n,
const uint *ids);
boolean IsTransformFeedback(uint id);
void BindTransformFeedback(
enum target, uint id);
target: TRANSFORM_FEEDBACK
void BeginTransformFeedback(
enum primitveMode);
primitveMode: TRIANGLES, LINES, POINTS
void EndTransformFeedback(void);
void PauseTransformFeedback(void);
void ResumeTransformFeedback(void);
Transform Feedback Drawing [13.2.3]
void DrawTransformFeedback(
enum mode, uint id);
mode: see Drawing Commands [10.5] above
void DrawTransformFeedbackInstanced(
enum mode, uint id,
sizei instancecount);
void DrawTransformFeedbackStream(
enum mode, uint id, uint stream);
void
DrawTransformFeedbackStreamInstanced(
enum mode, uint id, uint stream,
sizei instancecount);
Flatshading [13.4]
void ProvokingVertex(enum provokeMode);
provokeMode: {FIRST, LAST}_VERTEX_CONVENTION
Primitve Clipping [13.5]
Enable/Disable/IsEnabled(target);
target: DEPTH_CLAMP, CLIP_DISTANCEi where
i = [0..MAX_CLIP_DISTANCES - 1]
Controlling Viewport [13.6.1]
void DepthRangeArrayv(uint frst,
sizei count, const double *v);
void DepthRangeIndexed(uint index,
double n, double f);
void DepthRange(double n, double f);
void DepthRangef(foat n, foat f);
void ViewportArrayv(uint frst, sizei count,
const foat *v);
void ViewportIndexedf(uint index, foat x,
foat y, foat w, foat h);
void ViewportIndexedfv(uint index,
const foat *v);
void Viewport(int x, int y, sizei w, sizei h);
Rasterizaton [13.4, 14]
Enable/Disable/IsEnabled(target);
target: RASTERIZER_DISCARD
Multsampling [14.3.1]
Use to antalias points, and lines.
Enable/Disable/IsEnabled(target);
target: MULTISAMPLE, SAMPLE_SHADING
void GetMultsamplefv(enum pname,
uint index, foat *val);
pname: SAMPLE_POSITION
void MinSampleShading(foat value);
Points [14.4]
void PointSize(foat size);
void PointParameter{i f}(enum pname,
T param);
pname, param: see PointParameter{if}v
void PointParameter{i f}v(enum pname, const
T *params);
pname: POINT_FADE_THRESHOLD_SIZE,
POINT_SPRITE_COORD_ORIGIN
param, params: The fade threshold if pname is
POINT_FADE_THRESHOLD_SIZE;
{LOWER, UPPER}_LEFT if pname is
POINT_SPRITE_COORD_ORIGIN.
Enable/Disable/IsEnabled(target);
target: PROGRAM_POINT_SIZE
Line Segments [14.5]
Enable/Disable/IsEnabled(target);
target: LINE_SMOOTH
void LineWidth(foat width);
Polygons [14.6, 14.6.1]
Enable/Disable/IsEnabled(target);
target: POLYGON_SMOOTH, CULL_FACE
void FrontFace(enum dir);
dir: CCW, CW
(Contnued on next page >)
Vertces
Separate Patches [10.1.15]
void PatchParameteri(enum pname,
int value);
pname: PATCH_VERTICES
Current Vertex Atribute Values [10.2]
Specify generic atributes with components
of type foat (VertexAtrib*), int or uint
(VertexAtribI*), or double (VertexAtribL*).
void VertexAtrib{1234}{s f d}(uint index,
T values);
void VertexAtrib{123}{s f d}v(uint index,
const T *values);
void VertexAtrib4{b s i f d ub us ui}v(
uint index, const T *values);
void VertexAtrib4Nub(uint index, T values);
void VertexAtrib4N{b s i ub us ui}v(
uint index, const T *values);
void VertexAtribI{1234}{i ui}(uint index,
T values);
void VertexAtribI{1234}{i ui}v(uint index,
const T *values);
void VertexAtribI4{b s ub us}v(uint index,
const T *values);
void VertexAtribL{1234}d(uint index,
T values);
void VertexAtribL{1234}dv(uint index,
const T *values);
void VertexAtribP{1234}ui(uint index,
enum type, boolean normalized,
uint value);
void VertexAtribP{1234}uiv(uint index,
enum type, boolean normalized,
const uint *value);
type: [UNSIGNED_]INT_2_10_10_10_REV,
UNSIGNED_INT_10F_11F_11F_REV
Vertex Atributes [11.1.1]
Vertex shaders operate on array of
4-component items numbered from slot 0 to
MAX_VERTEX_ATTRIBS - 1.
void BindAtribLocaton(uint program,
uint index, const char *name);
void GetActveAtrib(uint program,
uint index, sizei bufSize, sizei *length,
int *size, enum *type, char *name);
int GetAtribLocaton(uint program,
const char *name);
Transform Feedback Variables [11.1.2]
void TransformFeedbackVaryings(
uint program, sizei count,
const char * const *varyings, enum
buferMode);
buferMode: {INTERLEAVED, SEPARATE}_ATTRIBS
void GetTransformFeedbackVarying(
uint program, uint index, sizei bufSize,
sizei *length, sizei *size, enum *type,
char *name);
*type returns NONE, FLOAT[_VECn],
DOUBLE[_VECn], [UNSIGNED_]INT,
[UNSIGNED_]INT_VECn, MATnxm,
{FLOAT, DOUBLE}_{MATn, MATnxm}
Shader Executon [11.1.3]
void ValidateProgram(uint program);
void ValidateProgramPipeline(uint pipeline);
Tessellaton Control Shaders [11.2.2]
void PatchParameterfv(enum pname,
const foat *values);
pname: PATCH_DEFAULT_{INNER, OUTER}_LEVEL
Vertex Arrays
Generic Vertex Atribute Arrays [10.3.1]
void VertexAtribFormat(uint atribindex,
int size, enum type, boolean normalized,
unit relatveofset);
type: [UNSIGNED_]BYTE, [UNSIGNED_]SHORT,
[UNSIGNED_]INT, [HALF_]FLOAT, DOUBLE, FIXED,
[UNSIGNED_]INT_2_10_10_10_REV,
UNSIGNED_INT_10F_11F_11F_REV
void VertexAtribIFormat(uint atribindex,
int size, enum type, unit relatveofset);
type: [UNSIGNED_]BYTE, [UNSIGNED_]SHORT,
[UNSIGNED_]INT
void VertexAtribLFormat(uint atribindex,
int size, enum type, unit relatveofset);
type: DOUBLE
void BindVertexBufer(uint bindingindex,
uint bufer, intptr ofset, sizei stride);
void BindVertexBufers(uint frst,
sizei count, const uint *bufers,
const intptr *ofsets, const sizei *strides);
void VertexAtribBinding(uint atribindex,
uint bindingindex);
void VertexAtribPointer(uint index, int size,
enum type, boolean normalized,
sizei stride, const void *pointer);
type: see VertexAtribFormat
void VertexAtribIPointer(uint index,
int size, enum type, sizei stride,
const void *pointer);
type: see VertexAtribIFormat
index: [0, MAX_VERTEX_ATTRIBS - 1]
void VertexAtribLPointer(uint index, int size,
enum type, sizei stride, const void*pointer);
type: DOUBLE
index: [0, MAX_VERTEX_ATTRIBS - 1]
void EnableVertexAtribArray(uint index);
void DisableVertexAtribArray(uint index);
index: [0, MAX_VERTEX_ATTRIBS - 1]
Vertex Atribute Divisors [10.3.2]
void VertexBindingDivisor(uint bindingindex,
uint divisor);
void VertexAtribDivisor(uint index,
uint divisor);
Primitve Restart [10.3.5]
Enable/Disable/IsEnabled(target);
target: PRIMITIVE_RESTART{_FIXED_INDEX}
void PrimitveRestartIndex(uint index);
Vertex Array Objects [10.4]
All states related to defniton of data used by
vertex processor is in a vertex array object.
void GenVertexArrays(sizei n, uint *arrays);
void DeleteVertexArrays(sizei n,
const uint *arrays);
void BindVertexArray(uint array);
boolean IsVertexArray(uint array);
Drawing Commands [10.5]
For all the functons in this secton:
mode: POINTS, LINE_STRIP, LINE_LOOP, LINES,
TRIANGLE_{STRIP, FAN}, TRIANGLES, PATCHES,
LINES_ADJACENCY, TRIANGLES_ADJACENCY, {LINE,
TRIANGLE}_STRIP_ADJACENCY,
type: UNSIGNED_{BYTE, SHORT, INT}
void DrawArrays(enum mode, int frst,
sizei count);
void DrawArraysInstancedBaseInstance(
enum mode, int frst, sizei count,
sizei instancecount, uint baseinstance);
void DrawArraysInstanced(enum mode,
int frst, sizei count, sizei instancecount);
void DrawArraysIndirect(enum mode,
const void *indirect);
void MultDrawArrays(enum mode,
const int *frst, const sizei *count,
sizei drawcount);
void MultDrawArraysIndirect(enum mode,
const void *indirect, sizei drawcount,
sizei stride);
void DrawElements(enum mode, sizei count,
enum type, const void *indices);
void DrawElementsInstancedBaseInstance(
enum mode, sizei count, enum type,
const void *indices, sizei instancecount,
uint baseinstance);
void DrawElementsInstanced(enum mode,
sizei count, enum type, const void *indices,
sizei instancecount);
void MultDrawElements(enum mode,
const sizei *count, enum type,
const void * const *indices,
sizei drawcount);
void DrawRangeElements(enum mode,
uint start, uint end, sizei count,
enum type, const void *indices);
void DrawElementsBaseVertex(enum mode,
sizei count, enum type, const void *indices,
int basevertex);
void DrawRangeElementsBaseVertex(
enum mode, uint start, uint end,
sizei count, enum type, const void *indices,
int basevertex);
void DrawElementsInstancedBaseVertex(
enum mode, sizei count, enum type,
const void *indices, sizei instancecount,
int basevertex);
void DrawElementsInstancedBase-
VertexBaseInstance(enum mode,
sizei count, enum type,
const void *indices, sizei instancecount,
int basevertex, uint baseinstance);
void DrawElementsIndirect(enum mode,
enum type, const void *indirect);
void MultDrawElementsIndirect(
enum mode, enum type,
const void *indirect, sizei drawcount,
sizei stride);
void MultDrawElementsBaseVertex(
enum mode, const sizei *count,
enum type, const void *const *indices,
sizei drawcount, const int *basevertex);
Vertex Array Queries [10.6]
void GetVertexAtrib{d f i}v(uint index,
enum pname, T *params);
pname: CURRENT_VERTEX_ATTRIB or
VERTEX_ATTRIB_ARRAY_X where X is one of
BUFFER_BINDING, DIVISOR, ENABLED, INTEGER,
LONG, NORMALIZED, SIZE, STRIDE, or TYPE
void GetVertexAtribI{i ui}v(uint index,
enum pname, T *params);
pname: see GetVertexAtrib{d f i}v
void GetVertexAtribLdv(uint index,
enum pname, double *params);
pname: see GetVertexAtrib{d f i}v
void GetVertexAtribPointerv(uint index,
enum pname, const void **pointer);
pname: VERTEX_ATTRIB_ARRAY_POINTER
Conditonal Rendering [10.10]
void BeginConditonalRender(uint id,
enum mode);
mode: {QUERY_BY_REGION, QUERY}_{WAIT,
NO_WAIT}
void EndConditonalRender(void);
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
OpenGL 4.4 API Reference Card Page 5

Whole Framebufer
Selectng a Bufer for Writng [17.4.1]
void DrawBufer(enum buf);
buf: [Tables 17.4-5] NONE,
{FRONT, BACK}_{LEFT, RIGHT}, FRONT, BACK,
LEFT, RIGHT, FRONT_AND_BACK,
COLOR_ATTACHMENTi (i = [0,
MAX_COLOR_ATTACHMENTS - 1 ])
void DrawBufers(sizei n, const enum *bufs);
bufs: [Tables 17.5-6] {FRONT, BACK}_{LEFT, RIGHT},
NONE, COLOR_ATTACHMENTi (i = [0,
MAX_COLOR_ATTACHMENTS - 1 ])
Fine Control of Bufer Updates [17.4.2]
void ColorMask(boolean r, boolean g,
boolean b, boolean a);
void ColorMaski(uint buf, 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 Bufers [17.4.3]
void Clear(bitield buf);
buf: 0 or the OR of
{COLOR, DEPTH, STENCIL}_BUFFER_BIT
void ClearColor(foat r, foat g, foat b, foat a);
void ClearDepth(double d);
void ClearDepthf(foat d);
void ClearStencil(int s);
void ClearBufer{i f ui}v(enum bufer,
int drawbufer, const T *value);
bufer: COLOR, DEPTH, STENCIL
void ClearBuferf(enum bufer,
int drawbufer, foat depth, int stencil);
bufer: DEPTH_STENCIL
drawbufer: 0
Invalidatng Framebufers [17.4.4]
void InvalidateSubFramebufer(
enum target, sizei numAtachments,
const enum *atachments, int x, int y,
sizei width, sizei height);
target: [DRAW_ , READ_]FRAMEBUFFER
atachments: COLOR_ATTACHMENTi, DEPTH,
{DEPTH, STENCIL}_ATTACHMENT,
DEPTH_STENCIL_ATTACHMENT, COLOR,
{FRONT, BACK}_{LEFT, RIGHT}, STENCIL
void InvalidateFramebufer(
enum target, sizei numAtachments,
const enum *atachments);
target, atachment: see InvalidateSubFramebufer
Reading and Copying Pixels
Reading Pixels [18.2]
void ReadPixels(int x, int y, sizei width,
sizei height, enum format, enum type,
void *data);
format: STENCIL_INDEX, RED, GREEN, BLUE, RG, RGB,
RGBA, BGR, DEPTH_{COMPONENT, STENCIL},
{RED, GREEN, BLUE, RG, RGB}_INTEGER,
{RGBA, BGR, BGRA}_INTEGER, BGRA [Table 8.3]
type: [HALF_]FLOAT, [UNSIGNED_]BYTE,
[UNSIGNED_]SHORT, [UNSIGNED_]INT,
FLOAT_32_UNSIGNED_INT_24_8_REV,
UNSIGNED_{BYTE, SHORT, INT}_* values in
[Table 8.2]
void ReadBufer(enum src);
src: NONE, {FRONT, BACK}_{LEFT, RIGHT}, FRONT,
BACK, LEFT, RIGHT, FRONT_AND_BACK,
COLOR_ATTACHMENTi (i =
[0, MAX_COLOR_ATTACHMENTS - 1 ])
Final Conversion [18.2.6]
void ClampColor(enum target, enum clamp);
target: CLAMP_READ_COLOR
clamp: TRUE, FALSE, FIXED_ONLY
Copying Pixels [18.3]
void BlitFramebufer(int srcX0, int srcY0,
int srcX1, int srcY1, int dstX0, int dstY0,
int dstX1, int dstY1, bitield mask,
enum flter);
mask: Bitwise OR of
{COLOR, DEPTH, STENCIL}_BUFFER_BIT or 0
flter: LINEAR, NEAREST
void CopyImageSubData(uint srcName,
enum srcTarget, int srcLevel, int srcX,
int srcY, int srcZ, uint dstName,
enum dstTarget, int dstLevel, int dstX,
int dstY, int dstZ, sizei srcWidth,
sizei srcHeight, sizei srcDepth);
srcTarget, dstTarget: see target for BindTexture in
secton [8.1] on this card, plus GL_RENDERTARGET
Compute Shaders [19]
void DispatchCompute(
uint num_groups_x,
uint num_groups_y,
uint num_groups_z);
void DispatchComputeIndirect(
intptr indirect);
Fragment Shaders [15.2]
void BindFragDataLocatonIndexed(
uint program, uint colorNumber,
uint index, const char *name);
void BindFragDataLocaton(uint program,
uint colorNumber, const char *name);
int GetFragDataLocaton(uint program,
const char *name);
int GetFragDataIndex(uint program,
const char *name);
Per-Fragment Operatons
Scissor Test [17.3.2]
Enable/Disable/IsEnabled(SCISSOR_TEST);
Enablei/Disablei/IsEnabledi(SCISSOR_TEST,
uint index);
void ScissorArrayv(uint frst, sizei count,
const int *v);
void ScissorIndexed(uint index, int lef,
int botom, sizei width, sizei height);
void ScissorIndexedv(uint index, int *v);
void Scissor(int lef, int botom, sizei width,
sizei height);
Multsample Fragment Ops. [17.3.3]
Enable/Disable/IsEnabled(target);
target: SAMPLE_ALPHA_TO_{COVERAGE, ONE},
SAMPLE_COVERAGE, SAMPLE_MASK
void SampleCoverage(foat value,
boolean invert);
void SampleMaski(uint maskNumber,
bitield mask);
Stencil Test [17.3.5]
Enable/Disable/IsEnabled(STENCIL_TEST);
void StencilFunc(enum func, int ref,
uint mask);
func: NEVER, ALWAYS, LESS, GREATER, EQUAL,
LEQUAL, GEQUAL, NOTEQUAL
void StencilFuncSeparate(enum face,
enum func, int ref, uint mask);
func: see StencilFunc
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, dppass: KEEP, ZERO, REPLACE, INCR,
DECR, INVERT, INCR_WRAP, DECR_WRAP
Depth Bufer Test [17.3.6]
Enable/Disable/IsEnabled(DEPTH_TEST);
void DepthFunc(enum func);
func: see StencilFunc
Occlusion Queries [17.3.7]
BeginQuery(enum target, uint id);
EndQuery(enum target);
target: SAMPLES_PASSED, ANY_SAMPLES_
PASSED, ANY_SAMPLES_PASSED_
CONSERVATIVE
Blending [17.3.8]
Enable/Disable/IsEnabled(BLEND);
Enablei/Disablei/IsEnabledi(BLEND,
uint index);
void BlendEquaton(enum mode);
void BlendEquatonSeparate(enum
modeRGB, enum modeAlpha);
mode, modeRGB, modeAlpha: MIN, MAX ,
FUNC_{ADD, SUBTRACT, REVERSE_SUBTRACT}
void BlendEquatoni(uint buf, enum
mode);
void BlendEquatonSeparatei(uint buf,
enum modeRGB, enum modeAlpha);
mode, modeRGB, modeAlpha:
see BlendEquatonSeparate
void BlendFunc(enum src, enum dst);
src, dst: see BlendFuncSeparate
void BlendFuncSeparate(enum srcRGB,
enum dstRGB, enum srcAlpha,
enum dstAlpha);
src, dst, srcRGB, dstRGB, srcAlpha, dstAlpha:
ZERO, ONE, SRC_ALPHA_SATURATE,
{SRC, SRC1, DST, CONSTANT}_{COLOR, ALPHA},
ONE_MINUS_{SRC, SRC1}_{COLOR, ALPHA},
ONE_MINUS_{DST, CONSTANT}_{COLOR, ALPHA}
void BlendFunci(uint buf, enum src,
enum dst);
src, dst: see BlendFuncSeparate
void BlendFuncSeparatei(uint buf,
enum srcRGB, enum dstRGB,
enum srcAlpha, enum dstAlpha);
dstRGB, dstAlpha, srcRGB, srcAlpha:
see BlendFuncSeparate
void BlendColor(foat red, foat green, foat
blue, foat alpha);
Dithering [17.3.10]
Enable/Disable/IsEnabled(DITHER);
Logical Operaton [17.3.11]
Enable/Disable/IsEnabled(COLOR_LOGIC_OP);
void LogicOp(enum op);
op: CLEAR, AND, AND_REVERSE, COPY,
AND_INVERTED, NOOP, XOR, OR, NOR,
EQUIV, INVERT, OR_REVERSE, COPY_INVERTED,
OR_INVERTED, NAND, SET
Rasterizaton (cont.)
void CullFace(enum mode);
mode: FRONT, BACK, FRONT_AND_BACK
Polygon Rast. & Depth Ofset [14.6.4-5]
void PolygonMode(enum face, enum
mode);
face: FRONT_AND_BACK
mode: POINT, LINE, FILL
void PolygonOfset(foat factor, foat units);
Enable/Disable/IsEnabled(target);
target: POLYGON_OFFSET_{POINT, LINE, FILL}
Debug Output [20]
Enable/Disable/IsEnabled(
DEBUG_OUTPUT);
Debug Message Callback [20.2]
void DebugMessageCallback(
DEBUGPROC callback, void *userParam);
callback: has the prototype:
void callback(enum source, enum type,
uint id, enum severity, sizei length,
const char *message, void *userParam);
source: DEBUG_SOURCE_X where X may be API,
SHADER_COMPILER, WINDOW_SYSTEM,
THIRD_PARTY, APPLICATION, OTHER
type: DEBUG_TYPE_X where X may be ERROR,
MARKER, OTHER, DEPRECATED_BEHAVIOR,
UNDEFINED_BEHAVIOR, PERFORMANCE,
PORTABILITY, {PUSH, POP}_GROUP
severity: DEBUG_SEVERITY_{HIGH, MEDIUM},
DEBUG_SEVERITY_{LOW, NOTIFICATION}
Controlling Debug Messages [20.4]
void DebugMessageControl(enum source,
enum type, enum severity, sizei count,
const uint *ids, boolean enabled);
source, type, severity: see callback (above),
plus DONT_CARE
Externally Generated Messages [20.5]
void DebugMessageInsert(enum source,
enum type, uint id, enum severity,
int length, const char *buf);
source: DEBUG_SOURCE_{APPLICATION, THIRD_PARTY}
type, severity: see DebugMessageCallback
Debug Groups [20.6]
void PushDebugGroup(enum source,
uint id, sizei length, const char *message);
source: see DebugMessageInsert
void PopDebugGroup(void);
Debug Labels [20.7]
void ObjectLabel(enum identfer,
uint name, sizei length, const char *label);
identfer: BUFFER, FRAMEBUFFER,
RENDERBUFFER, PROGRAM_PIPELINE,
PROGRAM, QUERY, SAMPLER, SHADER,
TEXTURE, TRANSFORM_FEEDBACK,
VERTEX_ARRAY
void ObjectPtrLabel(void* ptr, sizei length,
const char *label);
Synchronous Debug Output [20.8]
Enable/Disable/IsEnabled(
DEBUG_OUTPUT_SYNCHRONOUS);
Debug Output Queries [20.9]
uint GetDebugMessageLog(uint count,
sizei bufSize, enum *sources,
enum *types, uint *ids,
enum *severites, sizei *lengths,
char *messageLog);
void GetObjectLabel(enum identfer,
uint name, sizei bufSize, sizei *length,
char *label);
void GetObjectPtrLabel(void* ptr,
sizei bufSize, sizei *length, char *label);
Hints [21.5]
void Hint(enum target, enum hint);
target: FRAGMENT_SHADER_DERIVATIVE_HINT,
TEXTURE_COMPRESSION_HINT,
{LINE, POLYGON}_SMOOTH_HINT
hint: FASTEST, NICEST, DONT_CARE
State and State Requests
A complete list of symbolic constants for states is
shown in the tables in [23].
Simple Queries [22.1]
void GetBooleanv(enum pname,
boolean *data);
void GetIntegerv(enum pname, int *data);
void GetInteger64v(enum pname,
int64 *data);
void GetFloatv(enum pname, foat *data);
void GetDoublev(enum pname,
double *data);
void GetDoublei_v(enum target, uint index,
double *data);
void GetBooleani_v(enum target,
uint index, boolean *data);
void GetIntegeri_v(enum target, uint index,
int *data);
void GetFloat_v(enum target, uint index,
foat *data);
(Contnued on next page >)
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 6 OpenGL 4.4 API Reference Card

States (cont.)
void GetInteger64i_v(enum target,
uint index, int64 *data);
boolean IsEnabled(enum cap);
boolean IsEnabledi(enum target, uint index);
String Queries [22.2]
void GetPointerv(enum pname,
void **params);
ubyte *GetString(enum name);
name: RENDERER, VENDOR, VERSION,
SHADING_LANGUAGE_VERSION
ubyte *GetStringi(enum name, uint index);
name: EXTENSIONS, SHADING_LANGUAGE_VERSION
index: EXTENSIONS range = [0, NUM_EXTENSIONS - 1]
SHADING_LANGUAGE_VERSION range = [0, NUM_
SHADING_LANGUAGE_VERSIONS-1]
Internal Format Queries [22.3]
void GetInternalformat64v(enum target,
enum internalformat, enum pname,
sizei bufSize, int64 *params);
target: [Table 22.2]
TEXTURE_{1D, 2D, 3D, CUBE_MAP}[_ARRAY],
TEXTURE_2D_MULTISAMPLE[_ARRAY],
TEXTURE_{BUFFER, RECTANGLE}, RENDERBUFFER
internalformat: any value
pname:
CLEAR_{BUFFER, TEXTURE}, COLOR_ENCODING,
COLOR_{COMPONENTS, RENDERABLE},
COMPUTE_TEXTURE,
DEPTH_{COMPONENTS, RENDERABLE},
FILTER, FRAMEBUFFER_BLEND,
FRAMEBUFFER_RENDERABLE[_LAYERED],
{FRAGMENT, GEOMETRY}_TEXTURE,
[MANUAL_GENERATE_]MIPMAP,
IMAGE_COMPATIBILITY_CLASS,
IMAGE_PIXEL_{FORMAT, TYPE},
IMAGE_FORMAT_COMPATIBILITY_TYPE,
IMAGE_TEXEL_SIZE,
INTERNALFORMAT_{PREFERRED, SUPPORTED},
INTERNALFORMAT_{RED, GREEN, BLUE}_SIZE,
INTERNALFORMAT_{DEPTH, STENCIL}_SIZE,
INTERNALFORMAT_{ALPHA, SHARED}_SIZE,
INTERNALFORMAT_{RED, GREEN}_TYPE,
INTERNALFORMAT_{BLUE, ALPHA}_TYPE,
INTERNALFORMAT_{DEPTH, STENCIL}_TYPE,
MAX_COMBINED_DIMENSIONS,
MAX_{WIDTH, HEIGHT, DEPTH, LAYERS},
NUM_SAMPLE_COUNTS,
READ_PIXELS[_FORMAT, _TYPE],
SAMPLES, SHADER_IMAGE_ATOMIC,
SHADER_IMAGE_{LOAD, STORE},
SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST,
SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE,
SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST,
SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE,
SRGB_{READ, WRITE},
STENCIL_COMPONENTS,
STENCIL_RENDERABLE,
TESS_CONTROL_TEXTURE,
TESS_EVALUATION_TEXTURE,
TEXTURE_COMPRESSED,
TEXTURE_COMPRESSED_BLOCK_HEIGHT,
TEXTURE_COMPRESSED_BLOCK_WIDTH,
TEXTURE_COMPRESSED_BLOCK_SIZE,
TEXTURE_GATHER[_SHADOW],
[GET_]TEXTURE_IMAGE_FORMAT,
[GET_]TEXTURE_IMAGE_TYPE,
TEXTURE_SHADOW,
TEXTURE_VIEW,
VERTEX_TEXTURE,
VIEW_COMPATIBILITY_CLASS
void GetInternalformatv(enum target,
enum internalformat, enum pname,
sizei bufSize, int *params);
target, pname, internalformat:
see GetInternalformat64v,
OpenGL Texture Views and Texture Object State
T
Texture state set with TextureView()
enum internalformat // base internal format enum target // texture target
uint minlevel // frst level of mipmap uint numlevels // number of mipmap levels
uint minlayer // frst layer of array texture uint numlayers // number of layers in array
Texture View Parameters (immutable)
<target>
TEXTURE_INTERNAL_FORMAT TEXTURE_SHARED_SIZE
TEXTURE_VIEW_{MIN,NUM}_LEVEL TEXTURE_VIEW_{MIN,NUM}_LAYER
TEXTURE_IMMUTABLE_LEVELS IMAGE_FORMAT_COMPATIBILITY_TYPE
TEXTURE_{RED,GREEN,BLUE,ALPHA,DEPTH}_TYPE
TEXTURE_{RED,GREEN,BLUE,ALPHA,DEPTH,STENCIL}_SIZE
Texture Parameters (immutable)
TEXTURE_WIDTH TEXTURE_HEIGHT
TEXTURE_DEPTH TEXTURE_FIXED_SAMPLE_LOCATIONS
TEXTURE_COMPRESSED TEXTURE_COMPRESSED_IMAGE_SIZE
TEXTURE_IMMUTABLE_FORMAT TEXTURE_SAMPLES
Texture Parameters (mutable)
TEXTURE_SWIZZLE_{R,G,B,A} TEXTURE_MAX_LEVEL
TEXTURE_BASE_LEVEL DEPTH_STENCIL_TEXTURE_MODE
Sampler Parameters (mutable)
TEXTURE_BORDER_COLOR
TEXTURE_COMPARE_{FUNC,MODE}
TEXTURE_LOD_BIAS
TEXTURE_{MAX,MIN}_LOD
TEXTURE_{MAG,MIN}_FILTER
TEXTURE_SRGB_DECODE
TEXTURE_WRAP_{S,T,R}
OpenGL Compute Programming Model and Compute Memory Hierarchy

Use the barrier functon to synchronize invocatons in a work group:
void barrier();
Use the memoryBarrier* or groupMemoryBarrier functons to order
reads/writes accessible to other invocatons:
void memoryBarrier();
void memoryBarrierAtomicCounter();
void memoryBarrierBuffer();
void memoryBarrierImage();
void memoryBarrierShared(); // Only for compute shaders
void groupMemoryBarrier(); // Only for compute shaders
Use the compute shader built-in variables to specify work groups and invocatons:
in vec3 gl_NumWorkGroups; // Number of workgroups dispatched
const vec3 gl_WorkGroupSize; // Size of each work group for current shader
in vec3 gl_WorkGroupID; // Index of current work group being executed
in vec3 gl_LocalInvocationID; // index of current invocation in a work group
in vec3 gl_GlobalInvocationID; // Unique ID across all work groups and threads. (gl_GlobalInvocationID = gl_WorkGroupID * gl_WorkGroupSize + gl_LocalInvocationID)
gl_WorkGroupSize = (4,2,0)
gl_WorkGroupID = (2,0,0)
gl_LocalInvocationID = (1,0,0)
gl_GlobalInvocationID = (9,0,0)
gl_NumWorkGroups = (4,2,0)
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
OpenGL 4.4 API Reference Card Page 7
OpenGL Pipeline
A typical program that uses OpenGL
begins with calls to open a window into
the framebufer into which the program
will draw. Calls are made to allocate a GL
context which is then associated with the
window, then OpenGL commands can be
issued.
The heavy black arrows in this illustraton
show the OpenGL pipeline and indicate
data fow.
Blue blocks indicate various bufers
that feed or get fed by the OpenGL
pipeline.
Green blocks indicate fxed functon
stages.
Yellow blocks indicate programmable
stages.
Texture binding
Bufer binding
T
B
Vertex & Tessellaton Details
Each vertex is processed either by a vertex shader
or fxed-functon vertex processing (compatbility
only) to generate a transformed vertex, then
assembled into primitves. Tessellaton (if enabled)
operates on patch primitves, consistng of a fxed-
size collecton of vertces, each with per-vertex
atributes and associated per-patch atributes.
Tessellaton control shaders (if enabled) transform
an input patch and compute per-vertex and per-
patch atributes for a new output patch.
A fxed-functon primitve generator
subdivides the patch according to
tessellaton levels computed in the
tessellaton control shaders or specifed
as fxed values in the API (TCS disabled).
The tessellaton evaluaton shader
computes the positon and atributes of
each vertex produced by the tessellator.
Orange blocks indicate features of the Core
specifcaton.
Purple blocks indicate features of the
Compatbility specifcaton.
Green blocks indicate features new or
signifcantly changed with OpenGL 4.x.
Geometry & Follow-on Details
Geometry shaders (if enabled) consume
individual primitves built in previous primitve
assembly stages. For each input primitve,
the geometry shader can output zero or more
vertces, with each vertex directed at a specifc
vertex stream. The vertces emited to each
stream are assembled into primitves according
to the geometry shaders output primitve type.
Transform feedback (if actve) writes selected
vertex atributes of the primitves of all vertex
streams into bufer objects atached to one or
more binding points.
Primitves on vertex stream zero are then
processed by fxed-functon stages, where they
are clipped and prepared for rasterizaton.
Orange blocks indicate features of the Core
specifcaton.
Purple blocks indicate features of the
Compatbility specifcaton.
Green blocks indicate features new or
signifcantly changed with OpenGL 4.x.
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 8 OpenGL Shading Language 4.40 Reference Card

Types [4.1]
Transparent Types
void no functon return value
bool Boolean
int, uint signed/unsigned integers
foat single-precision foatng-point
scalar
double double-precision foatng scalar
vec2, vec3, vec4 foatng point vector
dvec2, dvec3, dvec4 double precision foatng-point
vectors
bvec2, bvec3, bvec4 Boolean vectors
ivec2, ivec3, ivec4
uvec2, uvec3, uvec4
signed and unsigned integer
vectors
mat2, mat3, mat4 2x2, 3x3, 4x4 foat matrix
mat2x2, mat2x3,
mat2x4
2-column foat matrix of
2, 3, or 4 rows
mat3x2, mat3x3,
mat3x4
3-column foat matrix of
2, 3, or 4 rows
mat4x2, mat4x3,
mat4x4
4-column foat matrix of
2, 3, or 4 rows
dmat2, dmat3,
dmat4
2x2, 3x3, 4x4 double-precision
foat matrix
dmat2x2, dmat2x3,
dmat2x4
2-col. double-precision foat
matrix of 2, 3, 4 rows
dmat3x2, dmat3x3,
dmat3x4
3-col. double-precision foat
matrix of 2, 3, 4 rows
dmat4x2, dmat4x3,
dmat4x4
4-column double-precision foat
matrix of 2, 3, 4 rows
Floatng-Point Opaque Types
sampler{1D,2D,3D}
image{1D,2D,3D}
1D, 2D, or 3D texture
samplerCube
imageCube
cube mapped texture
sampler2DRect
image2DRect
rectangular texture
sampler{1D,2D}Array
image{1D,2D}Array
1D or 2D array texture
samplerBufer
imageBufer
bufer texture
sampler2DMS
image2DMS
2D mult-sample texture
sampler2DMSArray
image2DMSArray
2D mult-sample array
texture
samplerCubeArray
imageCubeArray
cube map array texture
sampler1DShadow
sampler2DShadow
1D or 2D depth texture
with comparison
sampler2DRectShadow rectangular tex. / compare
sampler1DArrayShadow
sampler2DArrayShadow
1D or 2D array depth
texture with comparison
samplerCubeShadow cube map depth texture
with comparison
samplerCubeArrayShadow cube map array depth
texture with comparison
Signed Integer Opaque Types
isampler[1,2,3]D integer 1D, 2D, or 3D texture
iimage[1,2,3]D integer 1D, 2D, or 3D image
isamplerCube integer cube mapped texture
iimageCube integer cube mapped image
isampler2DRect int. 2D rectangular texture
Contnue

Signed Integer Opaque Types (contd)


iimage2DRect int. 2D rectangular image
isampler[1,2]DArray integer 1D, 2D array texture
iimage[1,2]DArray integer 1D, 2D array image
isamplerBufer integer bufer texture
iimageBufer integer bufer image
isampler2DMS int. 2D mult-sample texture
iimage2DMS int. 2D mult-sample image
isampler2DMSArray int. 2D mult-sample array tex.
iimage2DMSArray int. 2D mult-sample array image
isamplerCubeArray int. cube map array texture
iimageCubeArray int. cube map array image
Unsigned Integer Opaque Types
atomic_uint uint atomic counter
usampler[1,2,3]D uint 1D, 2D, or 3D texture
uimage[1,2,3]D uint 1D, 2D, or 3D image
usamplerCube uint cube mapped texture
uimageCube uint cube mapped image
usampler2DRect uint rectangular texture
uimage2DRect uint rectangular image
usampler[1,2]DArray 1D or 2D array texture
uimage[1,2]DArray 1D or 2D array image
usamplerBufer uint bufer texture
uimageBufer uint bufer image
usampler2DMS uint 2D mult-sample texture
uimage2DMS uint 2D mult-sample image
usampler2DMSArray uint 2D mult-sample array tex.
Contnue

Unsigned Integer Opaque Types (contd)


uimage2DMSArray uint 2D mult-sample array image
usamplerCubeArray uint cube map array texture
uimageCubeArray uint cube map array image
Implicit Conversions
int -> uint uvec2 -> dvec2
int, uint -> foat uvec3 -> dvec3
int, uint, foat -> double uvec4 -> dvec4
ivec2 -> uvec2 vec2 -> dvec2
ivec3 -> uvec3 vec3 -> dvec3
ivec4 -> uvec4 vec4 -> dvec4
ivec2 -> vec2 mat2 -> dmat2
ivec3 -> vec3 mat3 -> dmat3
ivec4 -> vec4 mat4 -> dmat4
uvec2 -> vec2 mat2x3 -> dmat2x3
uvec3 -> vec3 mat2x4 -> dmat2x4
uvec4 -> vec4 mat3x2 -> dmat3x2
ivec2 -> dvec2 mat3x4 -> dmat3x4
ivec3 -> dvec3 mat4x2 -> dmat4x2
ivec4 -> dvec4 mat4x3 -> dmat4x4
Aggregaton of Basic Types
Arrays foat[3] foo; foat foo[3]; int a [3][2];
// Structures, blocks, and structure members
// can be arrays. Arrays of arrays supported.
Structures struct type-name {
members
} struct-name[];
// optonal variable declaraton
Blocks in/out/uniform block-name {
// interface matching by block name
optonally-qualifed members
} instance-name[];
// optonal instance name, optonally an array
Qualifers
Storage Qualifers [4.3]
Declaratons may have one storage qualifer.
none
(default) local read/write memory,
or input parameter
const read-only variable
in linkage into shader from previous stage
out linkage out of a shader to next stage
uniform
linkage between a shader, OpenGL,
and the applicaton
bufer accessible by shaders and OpenGL API
shared
compute shader only, shared among work
items in a local work group
Auxiliary Storage Qualifers
Use to qualify some input and output variables:
centroid centroid-based interpolaton
sampler per-sample interpolaton
patch per-tessellaton-patch atributes
Interface Blocks [4.3.9]
In, out, uniform, and bufer variable declaratons
can be grouped. For example:
uniform Transform {
mat4 ModelViewMatrix;
// allowed restatement qualifer
uniform mat3 NormalMatrix;
};
Layout Qualifers [4.4]
layout(layout-qualifers) block-declaraton
layout(layout-qualifers) in/out/uniform
layout(layout-qualifers) in/out/uniform
declaraton
INPIT/OUTPUT layout qualifer for all shader
stages except compute:
locaton = integer-constant-expression
component = integer-constant-expression
Tessellaton
INPUT: triangles, quads, equal_spacing,
isolines, fractonal_{even,odd}_spacing,
cw, ccw, point_mode
OUTPUT:
vertces = integer-constant-expression
Geometry Shader
INPUT: points, lines, triangles,
{lines,triangles}_adjacency,
invocatons = integer-constant-expression
OUTPUT:
points, line_strip, triangle_strip,
max_vertces = integer-constant-expression
stream = integer-constant-expression
Fragment Shader
INPUT: For redeclaring built-in variable
gl_FragCoord: origin_upper_lef,
pixel_center_integer.
For in only (not with variable declaratons):
early_fragment_tests.
OUTPUT: gl_FragDepth may be redeclared
using: depth_any, depth_greater,
depth_less, depth_unchanged.
Additonal qualifer for Fragment Shaders:
index = integer-constant-expression
Compute Shader
INPUT:
local_size_x = integer-constant-expression
local_size_y = integer-constant-expression
local_size_z = integer-constant-expression
Additonal Output Layout Qualifers [4.4.2]
Layout qualifers for Transform Feedback:
The vertex, tessellaton, and geometry stages
allow the following on output declaratons:
xf_bufer = integer-constant-expression
xf_ofset = integer-constant-expression
xf_stride = integer-constant-expression
Uniform Variable Layout Qualifers [4.4.3]
locaton = integer-constant-expression
Subroutne Functon Layout Qualifers [4.4.4]
index = integer-constant-expression
Uniform/Storage Block Layout Qualifers [4.4.5]
Layout qualifer identfers for uniform blocks:
shared, packed, std140, std340,
{row, column}_major,
binding = integer-constant-expression
ofset = integer-constant-expression
align = integer-constant-expression
Opaque Uniform Layout Qualifers [4.4.6]
Used to bind opaque uniform variables to
specifc bufers or units.
binding = integer-constant-expression
Atomic Counter Layout Qualifers
binding = integer-constant-expression
ofset = integer-constant-expression
(Contnued on next page >)
The OpenGL

Shading Language is used to create


shaders for each of the programmable processors
contained in the OpenGL processing pipeline.
The OpenGL Shading Language is actually several
closely related languages. Currently, these
processors are the vertex, tessellaton control,
tessellaton evaluaton, geometry, fragment, and
compute shaders.
[n.n.n] and [Table n.n] refer to sectons and
tables in the OpenGL Shading Language 4.40
specifcaton at www.opengl.org/registry
Operators and Expressions [5.1]
The following operators are numbered in order
of precedence. Relatonal and equality operators
evaluate to Boolean. Also see lessThan(), equal().
1. ( ) parenthetcal grouping
2.
[ ]
( )
.
++ --
array subscript
functon call, constructor, structure
feld, selector, swizzle
postix increment and decrement
3.
++ --
+ - ~ !
prefx increment and decrement
unary
4. * / % multplicatve
5. + - additve
6. << >> bit-wise shif
7. < > <= >= relatonal
8. == != equality
9. & bit-wise and
10. ^ bit-wise exclusive or
11. | bit-wise inclusive or
12. && logical and
13. ^^ logical exclusive or
14. | | logical inclusive or
15. ? : selects an entre operand
16.
= += -=
*= /=
%= <<= >>=
&= ^= |=
assignment
arithmetc assignments
17. , sequence
Vector & Scalar Components [5.5]
In additon to array numeric subscript syntax,
names of vector and scalar components are
denoted by a single leter. Components can be
swizzled and replicated. Scalars have only an x, r,
or s component.
{x, y, z, w} Points or normals
{r, g, b, a} Colors
{s, t, p, q} Texture coordinates
Preprocessor [3.3]
Preprocessor Directves
# #defne #elif #if #else
#extension #version #ifdef #ifndef #undef
#error #pragma #line #endif
Preprocessor Operators
#version 440
#version 440 profle
Required when using version 4.40.
profle is core, compatbility, or es.
#extension
extension_name : behavior
#extension all : behavior
behavior: require, enable, warn,
disable
extension_name: extension
supported by compiler, or all
Predefned Macros
__LINE__ __FILE__
Decimal integer constants. __FILE__ says
which source string is being processed.
__VERSION__ Decimal integer, e.g.: 440
GL_core_profle Defned as 1
GL_es_profle
1 if the implementaton supports the es
profle
GL_compatbility_profle
Defned as 1 if the implementaton
supports the compatbility profle.
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
OpenGL Shading Language 4.40 Reference Card Page 9

Operatons and Constructors


Vector & Matrix [5.4.2]
.length() for matrices returns number of columns
.length() for vectors returns number of components
mat2(vec2, vec2); // 1 col./arg.
mat2x3(vec2, foat, vec2, foat); // col. 2
dmat2(dvec2, dvec2); // 1 col./arg.
dmat3(dvec3, dvec3, dvec3); // 1 col./arg.
Structure Example [5.4.3]
.length() for structures returns number of members
struct light {members; };
light lightVar = light(3.0, vec3(1.0, 2.0, 3.0));
Array Example [5.4.4]
const foat c[3];
c.length() // will return the integer 3
Matrix Examples [5.6]
Examples of access components of a matrix with
array subscriptng syntax:
mat4 m; // m is a matrix
m[1] = vec4(2.0); // sets 2nd col. to all 2.0
m[0][0] = 1.0; // sets upper lef element to 1.0
m[2][3] = 2.0; // sets 4th element of 3rd col. to 2.0
Examples of operatons on matrices and vectors:
m = f * m; // scalar * matrix component-wise
v = f * v; // scalar * vector component-wise
v = v * v; // vector * vector component-wise
m = m +/- m; // matrix +/- matrix comp.-wise
m = m * m; // linear algebraic multply
f = dot(v, v); // vector dot product
v = cross(v, v); // vector cross product
Structure & Array Operatons [5.7]
Select structure felds or length() method of an
array using the period (.) operator. Other operators:
. feld or method selector
== != equality
= assignment
[ ] indexing (arrays only)
Array elements are accessed using the array
subscript operator ( [ ] ), e.g.:
difuseColor += lightIntensity[3]*NdotL;
Statements and Structure
Subroutnes [6.1.2]
Subroutne type variables are assigned to functons
through the UniformSubroutnesuiv command in the
OpenGL API.
Declare types with the subroutne keyword:
subroutne returnType subroutneTypeName(type0
arg0,
type1 arg1, ..., typen argn);
Associate functons with subroutne types of
matching declaratons by defning the functons
with the subroutne keyword and a list of
subroutne types the functon matches:
subroutne(subroutneTypeName0, ...,
subroutneTypeNameN)
returnType functonName(type0 arg0,
type1 arg1, ..., typen argn){ ... }
// functon body
Declare subroutne type variables with a specifc
subroutne type in a subroutne uniform variable
declaraton:
subroutne uniform subroutneTypeName
subroutneVarName;
Iteraton and Jumps [6.3-4]
Functon call by value-return
Iteraton for (;;) { break, contnue }
while ( ) { break, contnue }
do { break, contnue } while ( );
Selecton if ( ) { }
if ( ) { } else { }
switch ( ) { case integer: break;
default: }
Entry void main()
Jump break, contnue, return
(There is no goto)
Exit return in main()
discard // Fragment shader only
Qualifers (contnued)
Format Layout Qualifers
One qualifer may be used with variables
declared as image to specify the image format.
For tessellaton control shaders:
binding = integer-constant-expression,
rgba{32,16}f, rg{32,16}f, r{32,16}f,
rgba{16,8}, r11f_g11f_b10f, rgb10_a2{ui},
rg{16,8}, r{16,8}, rgba{32,16,8}i, rg{32,16,8}i,
r{32,16,8}i, rgba{32,16,8}ui, rg{32,16,8}ui,
r{32,16,8}ui, rgba{16,8}_snorm,
rg{16,8}_snorm, r{16,8}_snorm
Interpolaton Qualifers [4.5]
Qualify outputs from vertex shader and inputs
to fragment shader.
smooth perspectve correct interpolaton
fat no interpolaton
noperspectve linear interpolaton
Parameter Qualifers [4.6]
Input values copied in at functon call tme,
output values copied out at functon return.
none (default) same as in
in for functon parameters passed into
functon
const for functon parameters that cannot be
writen to
out for functon parameters passed back out of
functon, but not initalized when passed in
inout for functon parameters passed both into
and out of a functon
Precision Qualifers [4.7]
Qualify individual variables:
{highp, mediump, lowp} variable-declaraton;
Establish a default precision qualifer:
precision {highp, mediump, lowp} {int, foat};
Invariant Qualifers Examples [4.8]
These are for vertex, tessellaton, geometry,
and fragment languages.
#pragma STDGL
invariant(all)
force all output variables
to be invariant
invariant gl_Positon; qualify a previously
declared variable
invariant centroid out
vec3 Color;
qualify as part of a
variable declaraton
Precise Qualifer [4.9]
Ensures that operatons are executed in stated
order with operator consistency. For example,
a fused multply-add cannot be used in the
following; it requires two identcal multplies,
followed by an add.
precise out vec4 Positon = a * b + c * d;
Memory Qualifers [4.10]
Variables qualifed as image can have one or
more memory qualifers.
coherent reads and writes are coherent with
other shader invocatons
volatle underlying values may be changed by
other sources
restrict wont be accessed by other code
readonly read only
writeonly write only
Order of Qualifcaton [4.11]
When multple qualifers are present in a
declaraton they may appear in any order, but
must all appear before the type.
The layout qualifer is the only qualifer that can
appear more than once. Further, a declaraton
can have at most one storage qualifer, at most
one auxiliary storage qualifer, and at most one
interpolaton qualifer.
Multple memory qualifers can be used. Any
violaton of these rules will cause a compile-
tme error.
Built-In Constants [7.3]
The following are provided to all shaders. The
actual values are implementaton-dependent, but
must be at least the value shown.
const ivec3 gl_MaxComputeWorkGroupCount =
{65535, 65535, 65535} ;
const ivec3 gl_MaxComputeWorkGroupSize[] =
{1024, 1024, 64};
const int gl_MaxComputeUniformComponents = 1024;
const int gl_MaxComputeTextureImageUnits = 16;
const int gl_MaxComputeImageUniforms = 8;
const int gl_MaxComputeAtomicCounters = 8;
const int gl_MaxComputeAtomicCounterBufers = 1;
const int gl_MaxVertexAtribs = 16;
const int gl_MaxVertexUniformComponents = 1024;
const int gl_MaxVaryingComponents= 60;
const int gl_MaxVertexOutputComponents = 64;
const int gl_MaxGeometryInputComponents = 64;
const int gl_MaxGeometryOutputComponents = 128;
const int gl_MaxFragmentInputComponents = 128;
const int gl_MaxVertexTextureImageUnits = 16;
const int gl_MaxCombinedTextureImageUnits = 80;
const int gl_MaxTextureImageUnits = 16;
const int gl_MaxImageUnits = 8;
const int gl_MaxCombinedImageUnitsAndFragment -
Outputs = 8;
const int gl_MaxImageSamples = 0;
const int gl_MaxVertexImageUniforms= 0;
const int gl_MaxTessControlImageUniforms = 0;
const int gl_MaxTessEvaluatonImageUniforms = 0;
const int gl_MaxGeometryImageUniforms = 0;
const int gl_MaxFragmentImageUniforms = 8;
const int gl_MaxCombinedImageUniforms = 8;
const int gl_MaxFragmentUniformComponents = 1024;
const int gl_MaxDrawBufers = 8;
const int gl_MaxClipDistances = 8;
const int gl_MaxGeometryTextureImageUnits = 16;
const int gl_MaxGeometryOutputVertces = 256;
const int gl_MaxGeometryTotalOutputComponents = 1024;
const int gl_MaxGeometryUniformComponents = 1024;
const int gl_MaxGeometryVaryingComponents = 64;
const int gl_MaxTessControlInputComponents = 128;
const int gl_MaxTessControlOutputComponents = 128;
const int gl_MaxTessControlTextureImageUnits = 16;
const int gl_MaxTessControlUniformComponents = 1024;
const int gl_MaxTessControlTotalOutputComponents = 4096;
const int gl_MaxTessEvaluatonInputComponents = 128;
const int gl_MaxTessEvaluatonOutputComponents = 128;
const int gl_MaxTessEvaluatonTextureImageUnits = 16;
const int gl_MaxTessEvaluatonUniformComponents = 1024;
const int gl_MaxTessPatchComponents = 120;
const int gl_MaxPatchVertces = 32;
const int gl_MaxTessGenLevel = 64;
const int gl_MaxViewports = 16;
const int gl_MaxVertexUniformVectors = 256;
const int gl_MaxFragmentUniformVectors = 256;
const int gl_MaxVaryingVectors = 15;
const int gl_MaxVertexAtomicCounters = 0;
const int gl_MaxTessControlAtomicCounters = 0;
const int gl_MaxTessEvaluatonAtomicCounters = 0;
const int gl_MaxGeometryAtomicCounters = 0;
const int gl_MaxFragmentAtomicCounters = 8;
const int gl_MaxCombinedAtomicCounters = 8;
const int gl_MaxAtomicCounterBindings = 1;
const int gl_MaxVertexAtomicCounterBufers = 0;
const int gl_MaxTessControlAtomicCounterBufers = 0;
const int gl_MaxTessEvaluatonAtomicCounterBufers = 0;
const int gl_MaxGeometryAtomicCounterBufers = 0;
const int gl_MaxFragmentAtomicCounterBufers = 1;
const int gl_MaxCombinedAtomicCounterBufers = 1;
const int gl_MaxAtomicCounterBuferSize = 32;
const int gl_MinProgramTexelOfset = -8;
const int gl_MaxProgramTexelOfset = 7;
const int gl_MaxTransformFeedbackBufers = 4;
const int gl_MaxTransformFeedbackInterleaved -
Components = 64;
Built-In Variables [7]
Shaders communicate with fxed-functon
OpenGL pipeline stages and other shader
executables through built-in variables.
Vertex Language
I
n
p
u
t
s
in int gl_VertexID;
in int gl_InstanceID;
O
u
t
p
u
t
s
out gl_PerVertex {
vec4 gl_Positon;
foat gl_PointSize;
foat gl_ClipDistance[];
};
Tessellaton Control Language
I
n
p
u
t
s
in gl_PerVertex {
vec4 gl_Positon;
foat gl_PointSize;
foat gl_ClipDistance[];
} gl_in[gl_MaxPatchVertces];
in int gl_PatchVertcesIn;
in int gl_PrimitveID;
in int gl_InvocatonID;
O
u
t
p
u
t
s
out gl_PerVertex {
vec4 gl_Positon;
foat gl_PointSize;
foat gl_ClipDistance[];
} gl_out[];
patch out foat gl_TessLevelOuter[4];
patch out foat gl_TessLevelInner[2];
Tessellaton Evaluaton Language
I
n
p
u
t
s
in gl_PerVertex {
vec4 gl_Positon;
foat gl_PointSize;
foat gl_ClipDistance[];
} gl_in[gl_MaxPatchVertces];
in int gl_PatchVertcesIn;
in int gl_PrimitveID;
in vec3 gl_TessCoord;
patch in foat gl_TessLevelOuter[4];
patch in foat gl_TessLevelInner[2];
O
u
t
p
u
t
s
out gl_PerVertex {
vec4 gl_Positon;
foat gl_PointSize;
foat gl_ClipDistance[];
};
Geometry Language
I
n
p
u
t
s
in gl_PerVertex {
vec4 gl_Positon;
foat gl_PointSize;
foat gl_ClipDistance[];
} gl_in[];
in int gl_PrimitveIDIn;
in int gl_InvocatonID;
O
u
t
p
u
t
s
out gl_PerVertex {
vec4 gl_Positon;
foat gl_PointSize;
foat gl_ClipDistance[];
};
out int gl_PrimitveID;
out int gl_Layer;
out int gl_ViewportIndex;
Fragment Language
I
n
p
u
t
s
in vec4 gl_FragCoord;
in bool gl_FrontFacing;
in foat gl_ClipDistance[];
in vec2 gl_PointCoord;
in int gl_PrimitveID;
in int gl_SampleID;
in vec2 gl_SamplePositon;
in int gl_SampleMaskIn[];
in int gl_Layer;
in int gl_ViewportIndex;
O
u
t
p
u
t
s
out foat gl_FragDepth;
out int gl_SampleMask[];
Compute Language
More informaton in diagram on page 6.
I
n
p
u
t
s
Work group dimensions
in uvec3 gl_NumWorkGroups;
const uvec3 gl_WorkGroupSize;
in uvec3 gl_LocalGroupSize;
Work group and invocaton IDs
in uvec3 gl_WorkGroupID;
in uvec3 gl_LocalInvocatonID;
Derived variables
in uvec3 gl_GlobalInvocatonID;
in uint gl_LocalInvocatonIndex;
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 10 OpenGL Shading Language 4.40 Reference Card

Built-In Functons
Angle & Trig. Functons [8.1]
Functons will not result in a divide-by-zero
error. If the divisor of a rato is 0, then results
will be undefned. Component-wise operaton.
Parameters specifed as angle are in units of
radians. Tf=foat, vecn.
Tf radians(Tf degrees) degrees to radians
Tf degrees(Tf radians) radians to degrees
Tf sin(Tf angle) sine
Tf cos(Tf angle) cosine
Tf tan(Tf angle) tangent
Tf asin(Tf x) arc sine
Tf acos(Tf x) arc cosine
Tf atan(Tf y, Tf x)
Tf atan(Tf y_over_x)
arc tangent
Tf sinh(Tf x) hyperbolic sine
Tf cosh(Tf x) hyperbolic cosine
Tf tanh(Tf x) hyperbolic tangent
Tf asinh(Tf x) hyperbolic sine
Tf acosh(Tf x) hyperbolic cosine
Tf atanh(Tf x) hyperbolic tangent
Exponental Functons [8.2]
Component-wise operaton. Tf=foat, vecn.
Td= double, dvecn. Tfd= Tf, Td
Tf pow(Tf x, Tf y) x
y
Tf exp(Tf x) e
x
Tf log(Tf x) ln
Tf exp2(Tf x) 2
x
Tf log2(Tf x) log
2
Tfd sqrt(Tfd x) square root
Tfd inversesqrt(Tfd x) inverse square root
Common Functons [8.3]
Component-wise operaton. Tf=foat, vecn. Tb=bool,
bvecn. Ti=int, ivecn. Tu=uint, uvecn.
Td= double, dvecn. Tfd= Tf, Td. Tiu= Ti, Tu.
Returns absolute value:
Tfd abs(Tfd x) Ti abs(Ti x)
Returns -1.0, 0.0, or 1.0:
Tfd sign(Tfd x) Ti sign(Ti x)
Returns nearest integer <= x:
Tfd foor(Tfd x)
Returns nearest integer with absolute value <= absolute
value of x:
Tfd trunc(Tfd x)
Returns nearest integer, implementaton-dependent
rounding mode:
Tfd round(Tfd x)
Returns nearest integer, 0.5 rounds to nearest even integer:
Tfd roundEven(Tfd x)
Returns nearest integer >= x:
Tfd ceil(Tfd x)
Returns x - foor(x):
Tfd fract(Tfd x)
Returns modulus:
Tfd mod(Tfd x, Tfd y)
Tf mod(Tf x, foat y)
Td mod(Td x, double y)
Returns separate integer and fractonal parts:
Tfd modf(Tfd x, out Tfd i)
Returns minimum value:
Tfd min(Tfd x, Tfd y)
Tf min(Tf x, foat y)
Td min(Td x, double y)
Tiu min(Tiu x, Tiu y)
Ti min(Ti x, int y)
Tu min(Tu x, uint y)
(Contnue

)
Common Functons (cont.)
Returns maximum value:
Tfd max(Tfd x, Tfd y)
Tf max(Tf x, foat y)
Td max(Td x, double y)
Tiu max(Tiu x, Tiu y)
Ti max(Ti x, int y)
Tu max(Tu x, uint y)
Returns min(max(x, minVal), maxVal):
Tfd clamp(Tfd x, Tfd minVal, Tfd maxVal)
Tf clamp(Tf x, foat minVal, foat maxVal)
Td clamp(Td x, double minVal, double maxVal)
Tiu clamp(Tiu x, Tiu minVal, Tiu maxVal)
Ti clamp(Ti x, int minVal, int maxVal)
Tu clamp(Tu x, uint minVal, uint maxVal)
Returns linear blend of x and y:
Tfd mix(Tfd x, Tfd y, Tfd a)
Tf mix(Tf x, Tf y, foat a)
Td mix(Td x, Td y, double a)
Returns true if components in a select components from
y, else from x:
Tfd mix(Tfd x, Tfd y, Tb a)
Returns 0.0 if x < edge, else 1.0:
Tfd step(Tfd edge, Tfd x)
Tf step(foat edge, Tf x)
Td step(double edge, Td x)
Clamps and smoothes:
Tfd smoothstep(Tfd edge0, Tfd edge1, Tfd x)
Tf smoothstep(foat edge0, foat edge1, Tf x)
Td smoothstep(double edge0, double edge1, Td x)
Returns true if x is NaN:
Tb isnan(Tfd x)
Returns true if x is positve or negatve infnity:
Tb isinf(Tfd x)
Returns signed int or uint value of the encoding of a foat:
Ti foatBitsToInt(Tf value)
Tu foatBitsToUint(Tf value)
Returns foat value of a signed int or uint encoding of a foat:
Tf intBitsToFloat(Ti value) Tf uintBitsToFloat(Tu value)
Computes and returns a*b + c. Treated as a single operaton
when using precise:
Tfd fma(Tfd a, Tfd b, Tfd c)
Splits x into a foatng-point signifcand in the range [0.5, 1.0)
and an integer exponent of 2:
Tfd frexp(Tfd x, out Ti exp)
Builds a foatng-point number from x and the corresponding
integral exponent of 2 in exp:
Tfd ldexp(Tfd x, in Ti exp)
Floatng-Point Pack/Unpack [8.4]
These do not operate component-wise.
Converts each component of v into 8- or 16-bit ints, packs
results into the returned 32-bit unsigned integer:
uint packUnorm2x16(vec2 v)
uint packSnorm2x16(vec2 v)
uint packUnorm4x8(vec4 v)
uint packSnorm4x8(vec4 v)
Unpacks 32-bit p into two 16-bit uints, four 8-bit uints, or
signed ints. Then converts each component to a normalized
foat to generate a 2- or 4-component vector:
vec2 unpackUnorm2x16(uint p)
vec2 unpackSnorm2x16(uint p)
vec4 unpackUnorm4x8(uint p)
vec4 unpackSnorm4x8(uint p)
Packs components of v into a 64-bit value and returns a
double-precision value:
double packDouble2x32(uvec2 v)
Returns a 2-component vector representaton of v:
uvec2 unpackDouble2x32(double v)
Returns a uint by convertng the components of a two-
component foatng-point vector:
uint packHalf2x16(vec2 v)
Returns a two-component foatng-point vector:
vec2 unpackHalf2x16(uint v)
Geometric Functons [8.5]
These functons operate on vectors as vectors, not
component-wise. Tf=foat, vecn. Td =double, dvecn.
Tfd= foat, vecn, double, dvecn.
foat length(Tf x)
double length(Td x)
length of vector
foat distance(Tf p0, Tf p1)
double distance(Td p0, Td p1)
distance between points
foat dot(Tf x, Tf y)
double dot(Td x, Td y)
dot product
vec3 cross(vec3 x, vec3 y)
dvec3 cross(dvec3 x, dvec3 y)
cross product
Tfd normalize(Tfd x) normalize vector to length 1
Tfd faceforward(Tfd N,
Tfd I, Tfd Nref)
returns N if dot(Nref, I) <
0, else -N
Tfd refect(Tfd I, Tfd N) refecton directon
I - 2 * dot(N,I) * N
Tfd refract(Tfd I, Tfd N,
foat eta)
refracton vector
Matrix Functons [8.6]
N and M are 1, 2, 3, 4.
mat matrixCompMult(mat x, mat y)
dmat matrixCompMult(dmat x, dmat y)
component-wise
multply
matN outerProduct(vecN c, vecN r)
dmatN outerProduct(dvecN c, dvecN r)
outer product
(where N != M)
matNxM outerProduct(vecM c, vecN r)
dmatNxM outerProduct(dvecM c, dvecN r)
outer product
matN transpose(matN m)
dmatN transpose(dmatN m)
transpose
matNxM transpose(matMxN m)
dmatNxM transpose(dmatMxN m)
transpose
(where N != M)
foat determinant(matN m)
double determinant(dmatN m)
determinant
matN inverse(matN m)
dmatN inverse(dmatN m)
inverse
Vector Relatonal Functons [8.7]
Compare x and y component-wise. Sizes of the
input and return vectors for any partcular call
must match. Tvec=vecn, uvecn, ivecn.
bvecn lessThan(Tvec x, Tvec y) <
bvecn lessThanEqual(Tvec x, Tvec y) <=
bvecn greaterThan(Tvec x, Tvec y) >
bvecn greaterThanEqual(Tvec x, Tvec y) >=
bvecn equal(Tvec x, Tvec y)
bvecn equal(bvecn x, bvecn y)
==
bvecn notEqual(Tvec x, Tvec y)
bvecn notEqual(bvecn x, bvecn y)
!=
bool any(bvecn x)
true if any component of x is true
bool all(bvecn x) true if all comps. of x are true
bvecn not(bvecn x)
logical complement of x
Integer Functons [8.8]
Component-wise operaton. Tu=uint, uvecn.
Ti=int, ivecn. Tiu=int, ivecn, uint, uvecn.
Adds 32-bit uint x and y, returning the sum modulo 2
32
:
Tu uaddCarry(Tu x, Tu y, out Tu carry)
Subtracts y from x, returning the diference if non-negatve,
otherwise 2
32
plus the diference:
Tu usubBorrow(Tu x, Tu y, out Tu borrow)
(Contnue

)
Integer Functons (cont.)
Multplies 32-bit integers x and y, producing a 64-bit result:
void umulExtended(Tu x, Tu y, out Tu msb, out Tu lsb)
void imulExtended(Ti x, Ti y, out Ti msb, out Ti lsb)
Extracts bits [ofset, ofset + bits - 1] from value, returns
them in the least signifcant bits of the result:
Tiu bitieldExtract(Tiu value, int ofset, int bits)
Returns the reversal of the bits of value:
Tiu bitieldReverse(Tiu value)
Inserts the bits least-signifcant bits of insert into base:
Tiu bitieldInsert(Tiu base, Tiu insert, int ofset, int bits)
Returns the number of bits set to 1:
Ti bitCount(Tiu value)
Returns the bit number of the least signifcant bit:
Ti fndLSB(Tiu value)
Returns the bit number of the most signifcant bit:
Ti fndMSB(Tiu value)
Texture Lookup Functons [8.9]
Available to vertex, geometry, and fragment
shaders. See tables on next page.
Atomic-Counter Functons [8.10]
Returns the value of an atomic counter.
Atomically increments c then returns its prior value:
uint atomicCounterIncrement(atomic_uint c)
Atomically decrements c then returns its prior value:
uint atomicCounterDecrement(atomic_uint c)
Atomically returns the counter for c:
uint atomicCounter(atomic_uint c)
Atomic Memory Functons [8.11]
Operates on individual integers in bufer-object
or shared-variable storage. OP is Add, Min, Max,
And, Or, Xor, Exchange, or CompSwap.
uint atomicOP(inout uint mem, uint data)
int atomicOP(inout int mem, int data)
Image Functons [8.12]
In these image functons, IMAGE_PARAMS may
be one of the following:
gimage1D image, int P
gimage2D image, ivec2 P
gimage3D image, ivec3 P
gimage2DRect image, ivec2 P
gimageCube image, ivec3 P
gimageBufer image, int P
gimage1DArray image, ivec2 P
gimage2DArray image, ivec3 P
gimageCubeArray image, ivec3 P
gimage2DMS image, ivec2 P, int sample
gimage2DMSArray image, ivec3 P, int sample
Returns the dimensions of the images or images:
int imageSize(gimage{1D,Bufer} image)
ivec2 imageSize(gimage{2D,Cube,Rect,1DArray,
2DMS} image)
ivec3 imageSize(gimage{Cube,2D,2DMS}Array image)
vec3 imageSize(gimage3D image)
Loads texel at the coordinate P from the image unit image:
gvec4 imageLoad(readonly IMAGE_PARAMS)
Stores data into the texel at the coordinate P from
the image specifed by image:
void imageStore(writeonly IMAGE_PARAMS, gvec4 data)
(Contnued on next page >)
Type Abbreviatons for Built-in Functons: In vector types, n is 2, 3, or 4.
Tf=foat, vecn. Td =double, dvecn. Tfd= foat, vecn, double, dvecn. Tb= bool, bvecn.
Tu=uint, uvecn. Ti=int, ivecn. Tiu=int, ivecn, uint, uvecn. Tvec=vecn, uvecn, ivecn.
Within any one functon, type sizes and dimensionality must correspond afer implicit type
conversions. For example, foat round(foat) is supported, but foat round(vec4) is not.
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
OpenGL Shading Language 4.40 Reference Card Page 11

Texture Functons [8.9]


Available to vertex, geometry, and fragment
shaders. gvec4=vec4, ivec4, uvec4.
gsampler* =sampler*, isampler*, usampler*.
The P argument needs to have enough
components to specify each dimension, array
layer, or comparison for the selected sampler.
The dPdx and dPdy arguments need enough
components to specify the derivatve for each
dimension of the sampler.
Texture Query Functons [8.9.1]
textureSize functons return dimensions of lod
(if present) for the texture bound to sampler.
Components in return value are flled in with the
width, height, depth of the texture. For array
forms, the last component of the return value is
the number of layers in the texture array.
{int,ivec2,ivec3} textureSize(
gsampler{1D[Array],2D[Rect,Array],Cube} sampler[,
int lod])
{int,ivec2,ivec3} textureSize(
gsampler{Bufer,2DMS[Array]}sampler)
{int,ivec2,ivec3} textureSize(
sampler{1D, 2D, 2DRect,Cube[Array]}Shadow sampler[,
int lod])
ivec3 textureSize(samplerCubeArray sampler, int lod)
textureQueryLod functons return the mipmap
array(s) that would be accessed in the x
component of the return value. Returns the
computed level of detail relatve to the base level
in the y component of the return value.
vec2 textureQueryLod(
gsampler{1D[Array],2D[Array],3D,Cube[Array]} sampler,
{foat,vec2,vec3} P)
vec2 textureQueryLod(
sampler{1D[Array],2D[Array],Cube[Array]}Shadow sampler,
{foat,vec2,vec3} P)
textureQueryLevels functons return the number
of mipmap levels accessible in the texture
associated with sampler.
int textureQueryLevels(
gsampler{1D[Array],2D[Array],3D,Cube[Array]} sampler)
int textureQueryLevels(
sampler{1D[Array],2D[Array],Cube[Array]}Shadow sampler)
Texel Lookup Functons [8.9.2]
Use texture coordinate P to do a lookup in the texture
bound to sampler. For shadow forms, compare is
used as Dref and the array layer comes from P.w.
For non-shadow forms, the array layer comes from
the last component of P.
gvec4 texture(
gsampler{1D[Array],2D[Array,Rect],3D,Cube[Array]} sampler,
{foat,vec2,vec3,vec4} P [, foat bias])
foat texture(
sampler{1D[Array],2D[Array,Rect],Cube}Shadow sampler,
{vec3,vec4} P [, foat bias])
foat texture(gsamplerCubeArrayShadow sampler, vec4 P,
foat compare)
Texture lookup with projecton.
gvec4 textureProj(gsampler{1D,2D[Rect],3D} sampler,
vec{2,3,4} P [, foat bias])
foat textureProj(sampler{1D,2D[Rect]}Shadow sampler,
vec4 P [, foat bias])
Texture lookup as in texture but with explicit LOD.
gvec4 textureLod(
gsampler{1D[Array],2D[Array],3D,Cube[Array]} sampler,
{foat,vec2,vec3} P, foat lod)
foat textureLod(sampler{1D[Array],2D}Shadow sampler,
vec3 P, foat lod)
Ofset added before texture lookup.
gvec4 textureOfset(
gsampler{1D[Array],2D[Array,Rect],3D} sampler,
{foat,vec2,vec3} P, {int,ivec2,ivec3} ofset [, foat bias])
foat textureOfset(
sampler{1D[Array],2D[Rect,Array]}Shadow sampler,
{vec3, vec4} P, {int,ivec2} ofset [, foat bias])
Use integer texture coordinate P to lookup a single
texel from sampler.
gvec4 texelFetch(
gsampler{1D[Array],2D[Array,Rect],3D} sampler,
{int,ivec2,ivec3} P[, {int,ivec2} lod])
gvec4 texelFetch(gsampler{Bufer, 2DMS[Array]} sampler,
{int,ivec2,ivec3} P[, int sample])
Fetch single texel with ofset added before texture lookup.
gvec4 texelFetchOfset(
gsampler{1D[Array],2D[Array],3D} sampler,
{int,ivec2,ivec3} P, int lod, {int,ivec2,ivec3} ofset)
gvec4 texelFetchOfset(
gsampler2DRect sampler, ivec2 P, ivec2 ofset)
Projectve texture lookup with ofset added before
texture lookup.
gvec4 textureProjOfset(gsampler{1D,2D[Rect],3D} sampler,
vec{2,3,4} P, {int,ivec2,ivec3} ofset [, foat bias])
foat textureProjOfset(
sampler{1D,2D[Rect]}Shadow sampler, vec4 P,
{int,ivec2} ofset [, foat bias])
Ofset texture lookup with explicit LOD.
gvec4 textureLodOfset(
gsampler{1D[Array],2D[Array],3D} sampler,
{foat,vec2,vec3} P, foat lod, {int,ivec2,ivec3} ofset)
foat textureLodOfset(
sampler{1D[Array],2D}Shadow sampler, vec3 P, foat lod,
{int,ivec2} ofset)
Projectve texture lookup with explicit LOD.
gvec4 textureProjLod(gsampler{1D,2D,3D} sampler,
vec{2,3,4} P, foat lod)
foat textureProjLod(sampler{1D,2D}Shadow sampler,
vec4 P, foat lod)
Ofset projectve texture lookup with explicit LOD.
gvec4 textureProjLodOfset(gsampler{1D,2D,3D} sampler,
vec{2,3,4} P, foat lod, {int, ivec2, ivec3} ofset)
foat textureProjLodOfset(sampler{1D,2D}Shadow sampler,
vec4 P, foat lod, {int, ivec2} ofset)
Texture lookup as in texture but with explicit gradients.
gvec4 textureGrad(
gsampler{1D[Array],2D[Rect,Array],3D,Cube[Array]} sampler,
{foat, vec2, vec3,vec4} P, {foat, vec2, vec3} dPdx,
{foat, vec2, vec3} dPdy)
foat textureGrad(
sampler{1D[Array],2D[Rect,Array], Cube}Shadow sampler,
{vec3,vec4} P, {foat,vec2} dPdx, {foat,vec2, vec3} dPdy)
Texture lookup with both explicit gradient and ofset.
gvec4 textureGradOfset(
gsampler{1D[Array],2D[Rect,Array],3D} sampler,
{foat,vec2,vec3} P, {foat,vec2,vec3} dPdx,
{foat,vec2,vec3} dPdy, {int,ivec2,ivec3} ofset)
foat textureGradOfset(
sampler{1D[Array],2D[Rect,Array]}Shadow sampler,
{vec3,vec4} P, {foat,vec2} dPdx, {foat,vec2}dPdy,
{int,ivec2} ofset)
Texture lookup both projectvely as in textureProj, and
with explicit gradient as in textureGrad.
gvec4 textureProjGrad(gsampler{1D,2D[Rect],3D} sampler,
{vec2,vec3,vec4} P, {foat,vec2,vec3} dPdx,
{foat,vec2,vec3} dPdy)
foat textureProjGrad(sampler{1D,2D[Rect]}Shadow sampler,
vec4 P, {foat,vec2} dPdx, {foat,vec2} dPdy)
Texture lookup projectvely and with explicit gradient
as in textureProjGrad, as well as with ofset as in
textureOfset.
gvec4 textureProjGradOfset(
gsampler{1D,2D[Rect],3D} sampler, vec{2,3,4} P,
{foat,vec2,vec3} dPdx, {foat,vec2,vec3} dPdy,
{int,ivec2,ivec3} ofset)
foat textureProjGradOfset(
sampler{1D,2D[Rect]Shadow} sampler, vec4 P,
{foat,vec2} dPdx, {foat,vec2} dPdy, {ivec2,int,vec2} ofset)
Texture Gather Instructons [8.9.3]
These functons take components of a foatng-point
vector operand as a texture coordinate, determine
a set of four texels to sample from the base level of
detail of the specifed texture image, and return one
component from each texel in a four-component
result vector.
gvec4 textureGather(
gsampler{2D[Array,Rect],Cube[Array]} sampler,
{vec2,vec3,vec4} P [, int comp])
vec4 textureGather(
sampler{2D[Array,Rect],Cube[Array]}Shadow sampler,
{vec2,vec3,vec4} P, foat refZ)
Texture gather as in textureGather by ofset as
described in textureOfset except minimum and
maximum ofset values are given by
{MIN, MAX}_PROGRAM_TEXTURE_GATHER_OFFSET.
gvec4 textureGatherOfset(gsampler2D[Array,Rect] sampler,
{vec2,vec3} P, ivec2 ofset [, int comp])
vec4 textureGatherOfset(
sampler2D[Array,Rect]Shadow sampler,
{vec2,vec3} P, foat refZ, ivec2 ofset)
Texture gather as in textureGatherOfset except ofsets
determines locaton of the four texels to sample.
gvec4 textureGatherOfsets(gsampler2D[Array,Rect] sampler,
{vec2,vec3} P, ivec2 ofsets[4] [, int comp])
vec4 textureGatherOfsets(
sampler2D[Array,Rect]Shadow sampler,
{vec2,vec3} P, foat refZ, ivec2 ofsets[4])
Built-In Functons (cont.)
Image Functons (cont.)
Adds the value of data to the contents of the selected texel:
uint imageAtomicAdd(IMAGE_PARAMS, uint data)
int imageAtomicAdd(IMAGE_PARAMS, int data)
Takes the minimum of the value of data and the contents
of the selected texel:
uint imageAtomicMin(IMAGE_PARAMS, uint data)
int imageAtomicMin(IMAGE_PARAMS, int data)
Takes the maximum of the value data and the contents
of the selected texel:
uint imageAtomicMax(IMAGE_PARAMS, uint data)
int imageAtomicMax(IMAGE_PARAMS, int data)
Performs a bit-wise AND of the value of data and the
contents of the selected texel:
uint imageAtomicAnd(IMAGE_PARAMS, uint data)
int imageAtomicAnd(IMAGE_PARAMS, int data)
Performs a bit-wise OR of the value of data and the
contents of the selected texel:
uint imageAtomicOr(IMAGE_PARAMS, uint data)
int imageAtomicOr(IMAGE_PARAMS, int data)
(Contnue

)
Image Functons (cont.)
Performs a bit-wise exclusive OR of the value of data and
the contents of the selected texel:
uint imageAtomicXor(IMAGE_PARAMS, uint data)
int imageAtomicXor(IMAGE_PARAMS, int data)
Copies the value of data:
uint imageAtomicExchange(IMAGE_PARAMS, uint data)
int imageAtomicExchange(IMAGE_PARAMS, int data)
Compares the value of compare and contents of selected
texel. If equal, the new value is given by data; otherwise,
it is taken from the original value loaded from texel:
uint imageAtomicCompSwap(IMAGE_PARAMS,
uint compare, uint data)
int imageAtomicCompSwap(IMAGE_PARAMS, int compare,
int data)
Fragment Processing Functons [8.13]
Available only in fragment shaders.
Tf=foat, vecn.
Derivatve fragment-processing functons
Tf dFdx(Tf p) derivatve in x
Tf dFdy(Tf p) derivatve in y
Tf fwidth(Tf p)
sum of absolute derivatve in x and y;
abs(dFdx(p)) + abs(dFdy(p));
Interpolaton fragment-processing functons
Return value of interpolant sampled inside pixel and the
primitve:
Tf interpolateAtCentroid(Tf interpolant)
Return value of interpolant at locaton of sample # sample:
Tf interpolateAtSample(Tf interpolant, int sample)
Return value of interpolant sampled at fxed ofset ofset
from pixel center:
Tf interpolateAtOfset(Tf interpolant, vec2 ofset)
Noise Functons [8.14]
Returns noise value. Available to fragment, geometry,
and vertex shaders. n is 2, 3, or 4:
foat noise1(Tf x) vecn noisen(Tf x)
Geometry Shader Functons [8.15]
Only available in geometry shaders.
Emits values of output variables to current output
primitve stream stream:
void EmitStreamVertex(int stream)
Completes current output primitve stream stream and
starts a new one:
void EndStreamPrimitve(int stream)
(Contnue

)
Geometry Shader Functons (contd)
Emits values of output variables to the current output
primitve:
void EmitVertex()
Completes output primitve and starts a new one:
void EndPrimitve()
Other Shader Functons [8.16-17]
See diagram on page 11 for more informaton.
Synchronizes across shader invocatons:
void barrier()
Controls ordering of memory transactons issued by a
single shader invocaton:
void memoryBarrier()
Controls ordering of memory transactons as viewed by
other invocatons in a compute work group:
void groupMemoryBarrier()
Order reads and writes accessible to other invocatons:
void memoryBarrierAtomicCounter()
void memoryBarrierShared()
void memoryBarrierBufer()
void memoryBarrierImage()
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 12 OpenGL 4.4 API Reference Card
OpenGL is a registered trademark of Silicon Graphics Internatonal, used under license by Khronos Group.
The Khronos Group is an industry consortum creatng open standards for the authoring and acceleraton
of parallel computng, graphics and dynamic media on a wide variety of platorms and devices.
See www.khronos.org to learn more about the Khronos Group.
See www.opengl.org to learn more about OpenGL.
OpenGL API and OpenGL Shading Language Reference Card Index
The following index shows each item included on this card along with the page on which it is described. The color of the row in the table below is the color of the pane to which you should refer.
A
ActveShaderProgram 2
ActveTexture 2
Angle Functons 10
Arrays 7
Asynchronous Queries 1
Atomic Counter Functons 10
Atomic Memory Functons 10
AtachShader 1
B
BeginConditonalRender 4
BeginQuery[Indexed] 1
BeginQuery 5
BeginTransformFeedback 4
BindAtribLocaton 4
BindBufer* 1
BindFramebufer 3
BindFragData* 5
BindImageTexture 3
BindProgramPipeline 2
BindRenderbufer 3
BindSampler 2
BindTexture 2
BindTransformFeedback 4
BindVertex{Bufer, Array} 4
BlendColor 5
BlendEquaton[Separate]* 5
BlendFunc[Separate]* 5
BlitFramebufer 5
Bufer Objects 1
Bufer Textures 2
BuferStorage 1
Bufer[Sub]Data 1
C
Callback 5
CheckFramebuferStatus 3
ClampColor 5
Clear 5
ClearBufer[Sub]Data 1
ClearBufer* 5
ClearColor 5
ClearDepth[f] 5
ClearStencil 5
ClearTex[Sub]Image 3
ClientWaitSync 1
ColorMask[i] 5
Command Leters 1
Common Functons 10
CompileShader 1
CompressedTexImage* 3
CompressedTexSubImage* 3
Compute Programming Diagram 6
Compute Shaders 5
Constants 9
Constructors 9
Conversions 6
CopyBuferSubData 1
CopyImageSubData 5
CopyTexImage* 2
CopyTexSubImage* 2,3
CreateProgram 1
CreateShader[Programv] 1
Cube Map Texture Select 3
CullFace 4
D
DebugMessage* 5
DeleteBufers 1
DeleteFramebufers 3
DeleteProgram 1
DeleteProgramPipelines 2
DeleteQueries 1
DeleteRenderbufers 3
DeleteSamplers 2
DeleteShader 1
DeleteSync 1
DeleteTextures 2
DeleteTransformFeedbacks 4
DeleteVertexArrays 4
DepthFunc 5
DepthMask 5
DepthRange* 4
Derivatve Functons 9
DetachShader 1
DisableVertexAtribArray 4
DispatchCompute* 5
Dithering 5
DrawArrays* 4
DrawBufer 5
DrawElements* 4
DrawRangeElements[BaseVertex] 4
DrawTransformFeedback* 4
E
EnableVertexAtribArray 4
EndconditonalRender 4
EndQuery[Indexed] 1
EndQuery 5
EndTransformFeedback 4
Errors 1
Evaluators 6
Exponental Functons 10
F
FenceSync 1
Finish 1
Flatshading 4
Floatng-point Numbers 1
Floatng-Point Pack/Unpack Func. 10
Flush 1
FlushMappedBuferRange 1
Fragment Operatons 4,5
Fragment Processing Functons 11
Fragment Shaders 5
Framebufer 5
Framebufer Objects 3
FramebuferParameteri 3
FramebuferRenderbufer 3
FramebuferTexture* 3
FrontFace 4
G
GenBufers 1
GenerateMipmap 3
GenFramebufers 3
GenProgramPipelines 2
GenQueries 1
GenRenderbufers 3
GenSamplers 2
GenTextures 2
GenTransformFeedbacks 4
GenVertexArrays 4
Geometric Functons 11
Geometry & Follow-on Diagram 7
GetActveAtomicCounterBufer 2
GetActveAtrib 4
GetActveSubroutne* 2
GetActveUniform* 2
GetAtachedShaders 3
GetAtribLocaton 4
GetBoolean* 5
GetBuferParameter* 1
GetBuferPointerv 1
GetBuferSubData 1
GetCompressedTexImage 3
GetDebugMessageLog 5
GetDouble* 5
GetError 1
GetFloat* 5
GetFragData* 5
GetFramebuferAtachment... 3
GetFramebuferParameteriv 3
GetInteger* 5,6
GetInteger64v 1
GetInternalFormat* 6
GetMultsamplefv 4
GetObject[Ptr]Label 5
GetPointerv 6
GetProgram* 1
GetProgramiv 2
GetProgramBinary 2
GetProgram[Pipeline]InfoLog 2
GetProgram[Pipeline, Stage]iv 2
GetQuery* 1
GetRenderbuferParameteriv 3
GetSamplerParameter* 2
GetShaderiv 2
GetShaderInfoLog 2
GetShaderPrecisionFormat 2
GetShaderSource 2
GetString* 6
GetSubroutneIndex 2
GetSubroutneUniformLocaton 2
GetSynciv 1
GetTexImage 3
GetTex[Level]Parameter* 3
GetTransformFeedbackVarying 4
GetUniform* 2
GetUniform{f d i ui}v 3
GetUniformSubroutneuiv 3
GetVertexAtrib* 4
GL Command Syntax 1
H
Hint 5
I
Image Functons 10,11
Integer Functons 10
Interpolaton Functons 9
Interpolaton Qualifers 9
InvalidateBufer* 1
Invalidate[Sub]Framebufer 5
InvalidateTex[Sub]Image 3
Invariant Qualifers 7
IsBufer 1
IsFramebufer 3
IsProgram 1
IsProgramPipeline 2
IsQuery 1
IsRenderbufer 3
IsSampler 2
IsShader 1
IsSync 1
IsTexture 2
IsTransformFeedback 4
IsVertexArray 4
Iteraton and Jumps 9
L
Layout Qualifers 8
LineWidth 4
LinkProgram 1
LogicOp 5
M
Macros 6
MapBufer[Range] 1
Matrices 2
Matrix Examples 9
Matrix Functons 10
MemoryBarrier 2
MemoryBarrier 9
Memory Qualifers 7
MinSampleShading 4
MultDraw{Arrays, Elements}* 4
MultDrawElementsBaseVertex 4
Multsample Fragment Ops 4
Multsample Textures 2
Multsampling 4
N
Noise Functons 11
O
Object[Ptr]Label 5
Occlusion Queries 5
OpenGL Shading Language 8-11
Operators 8,9
P
Pack/Unpack Functons 8
Parameter Qualifers 9
PatchParameter 4
PauseTransformFeedback 4
Pipeline Diagram 7
PixelStore{if} 2
PointParameter* 4
PointSize 4
Polygon{Mode, Ofset} 5
{Pop, Push}DebugGroup 5
Precise & Precision Qualifers 9
Predefned Macros 8
Preprocessor 8
Primitve Clipping 4
PrimitveRestartIndex 4
Program Objects 2
Program Queries 2
ProgramBinary 2
ProgramParameteri 1
ProgramUniform[Matrix]* 2
ProvokingVertex 4
{Push, Pop}Group 5
Q
Qualifers 8,9
QueryCounter 1
R
Rasterizaton 4
ReadBufer 5
ReadPixels 5
ReleaseShaderCompiler 1
Renderbufer Object Queries 3
RenderbuferStorage[Multsample] 3
ResumeTransformFeedback 4
S
SampleCoverage 5
SampleMaski 5
Sampler Queries 2
SamplerParameter* 2
Scissor[Indexed]* 5
ScissorArrayv 5
Shaders and Programs 1,2
Shader Functons 11
Shader[Binary, Source] 1
ShadersStorageBlockBinding 2
State and State Requests 5
Statements 9
StencilFunc[Separate] 5
StencilMask[Separate] 5
StencilOp[Separate] 5
Storage Qualifers 8
Structures 7
Subroutne Uniform Variables 2
Subroutnes 9
Synchronizaton 1
T
Tessellaton Diagram 7
TexBufer* 3
TexImage* 2
TexImage*Multsample 3
TexStorage{1, 2, 3}D 3
TexSubImage* 2
TexParameter* 3
Texture/Texel Functons 11
Texture Queries 11
TextureView 3
Texture View/State Diagram 6
Texturing 2,3
Timer Queries 1
Transform Feedback 4
TransformFeedbackVaryings 4
Trigonometry Functons 10
Types 8
U
Uniform Qualifers 6
Uniform Variables 2
Uniform* 2
UniformBlockBinding 2
UniformMatrix* 2
UniformSubroutnesuiv 2
UnmapBufer 1
UseProgram 1
UseProgramStages 2
V
ValidateProgram[Pipeline] 4
Variables 9
Vector & Matrix 7
Vector Relatonal Functons 10
Vertex & Tessellaton Diagram 7
Vertex Arrays 4
VertexAtrib* 4
VertexAtrib*Format 4
VertexAtrib*Pointer 4
VertexAtrib[Binding, Divisor] 4
VertexBindingDivisor 4
Viewport* 4
W
WaitSync 1
Reference card producton by Miller & Mattson www.millermatson.com

You might also like