Sie sind auf Seite 1von 13

OpenGL 4.

5 API Reference Card Page 1


OpenGL® is the only cross-platform graphics API that enables
developers of software for PC, workstation, and supercomputing
hardware to create high-performance, visually-compelling graphics
software applications, in markets such as CAD, content creation,
energy, entertainment, game development, manufacturing, • See FunctionName refers to functions on this reference card.
medical, and virtual reality. • [n.n.n] and [Table n.n] refer to sections and tables in the OpenGL 4.5 core specification.
Specifications are available at www.opengl.org/registry • [n.n.n] refers to sections in the OpenGL Shading Language 4.50 specification.

Command Execution [2.3] Floating-Point Numbers [2.3.4] OpenGL Command Syntax [2.2]
1-bit sign, 5-bit exponent, GL commands are formed from a return type, a name, and optionally up to 4 characters
OpenGL Errors [2.3.1] 16-Bit
10-bit mantissa (or character pairs) from the Command Letters table (to the left), as shown by the prototype:
enum GetError(void); no sign bit, 5-bit exponent,
Unsigned 11-Bit return-type Name{1234}{b s i i64 f d ub us ui ui64}{v} ([args ,] T arg1 , . . . , T argN [, args]);
6-bit mantissa
Graphics Reset Recovery [2.3.2]
no sign bit, 5-bit exponent,
enum GetGraphicsResetStatus(void); Unsigned 10-Bit
5-bit mantissa
The arguments enclosed in brackets ([args ,] and [, args]) may or may not be present.
Returns: NO_ERROR, GUILTY_CONTEXT_RESET, The argument type T and the number N of arguments may be indicated by the command name
{INNOCENT, UNKNOWN}_CONTEXT_RESET Command Letters [Tables 2.1, 2.2] suffixes. N is 1, 2, 3, or 4 if present. If “v” is present, an array of N items is passed by a pointer.
GetIntegerv( Where a letter denotes a type in a function For brevity, the OpenGL documentation and this reference may omit the standard prefixes.
RESET_NOTIFICATION_STRATEGY); name, T within the prototype is the same type.
Returns: NO_RESET_NOTIFICATION, The actual names are of the forms: glFunctionName(), GL_CONSTANT, GLtype
b - byte (8 bits) ub - ubyte (8 bits)
LOSE_CONTEXT_ON_RESET
s - short (16 bits) us - ushort (16 bits)
Flush and Finish [2.3.3] i - int (32 bits) ui - uint (32 bits) Asynchronous Queries [4.2, 4.2.1] void GetQueryiv(enum target, enum pname,
int *params);
void Flush(void); void Finish(void); i64 - int64 (64 bits) ui64 - uint64 (64 bits) void GenQueries(sizei n, uint *ids);
f - float (32 bits) d - double (64 bits) target: See BeginQuery, plus TIMESTAMP
void CreateQueries(enum target, sizei n, pname: CURRENT_QUERY, QUERY_COUNTER_BITS
uint *ids);
target: See BeginQuery, plus TIMESTAMP void GetQueryIndexediv(enum target,
Synchronization Waiting for Sync Objects [4.1.1]
void DeleteQueries(sizei n, const uint *ids);
uint index, enum pname, int *params);
target: See BeginQuery, plus TIMESTAMP
enum ClientWaitSync(sync sync,
Sync Objects and Fences [4.1] bitfield flags, uint64 timeout_ns); void BeginQuery(enum target, uint id); pname: CURRENT_QUERY, QUERY_COUNTER_BITS
void DeleteSync(sync sync); flags: SYNC_FLUSH_COMMANDS_BIT, or zero target: ANY_SAMPLES_PASSED[_CONSERVATIVE],
PRIMITIVES_GENERATED,
void GetQueryObjectiv(uint id, enum pname,
sync FenceSync(enum condition, bitfield flags); void WaitSync(sync sync, bitfield flags, int *params);
condition: SYNC_GPU_COMMANDS_COMPLETE SAMPLES_PASSED, TIME_ELAPSED,
uint64 timeout); TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN
flags: must be 0 void GetQueryObjectuiv(uint id,
timeout: TIMEOUT_IGNORED enum pname, uint *params);
void BeginQueryIndexed(enum target,
Sync Object Queries [4.1.3] uint index, uint id); void GetQueryObjecti64v(uint id,
Buffer Objects [6] void GetSynciv(sync sync, enum pname, target: See BeginQuery enum pname, int64 *params);
void GenBuffers(sizei n, uint *buffers); sizei bufSize, sizei *length, int *values);
pname: OBJECT_TYPE, SYNC_{STATUS, CONDITION, FLAGS} void EndQuery(enum target); void GetQueryObjectui64v(uint id,
void CreateBuffers(sizei n, uint *buffers); void EndQueryIndexed(enum target, enum pname, uint64 *params);
boolean IsSync(sync sync); uint index);
void DeleteBuffers(sizei n, const uint *buffers); pname: QUERY_TARGET,
QUERY_RESULT[_NO_WAIT, _AVAILABLE]
Create and Bind Buffer Objects [6.1] boolean IsQuery(uint id);
void BindBuffer(enum target, uint buffer); void BufferSubData(enum target,
target: [Table 6.1] {ARRAY, UNIFORM}_BUFFER, intptr offset, sizeiptr size,
{ATOMIC_COUNTER, QUERY}_BUFFER, const void *data); Timer Queries [4.3] void QueryCounter(uint id, TIMESTAMP);
COPY_{READ, WRITE}_BUFFER, target: See BindBuffer Timer queries track the amount of time needed void GetIntegerv(TIMESTAMP, int *data);
{DISPATCH, DRAW}_INDIRECT_BUFFER, to fully complete a set of GL commands. void GetInteger64v(TIMESTAMP, int64 *data);
{ELEMENT_ARRAY, TEXTURE}_BUFFER,
void NamedBufferSubData(uint buffer,
intptr offset, sizeiptr size,
PIXEL_[UN]PACK_BUFFER, const void *data);
SHADER_STORAGE_BUFFER, void *MapBuffer(enum target, enum access); void GetBufferParameteri[64]v(
TRANSFORM_FEEDBACK_BUFFER void ClearBufferSubData(enum target, access: See MapBufferRange enum target, enum pname, int[64]*data);
enum internalFormat, intptr offset, void *MapNamedBuffer(uint buffer, target: See BindBuffer
void BindBufferRange(enum target, sizeiptr size, enum format, enum type,
uint index, uint buffer, intptr offset, enum access); pname: [Table 6.2] BUFFER_SIZE, BUFFER_USAGE,
const void *data); BUFFER_{ACCESS[_FLAGS]}, BUFFER_MAPPED,
sizeiptr size); target: See BindBuffer access: See MapBufferRange
target: ATOMIC_COUNTER_BUFFER, BUFFER_MAP_{OFFSET, LENGTH},
internalformat: See TexBuffer on pg. 3 of this card void FlushMappedBufferRange(intptr offset, BUFFER_{IMMUTABLE_STORAGE, ACCESS_FLAGS}
{SHADER_STORAGE, UNIFORM}_BUFFER,
format: RED, GREEN, BLUE, RG, RGB, RGBA, BGR, sizeiptr length);
TRANSFORM_FEEDBACK_BUFFER
BGRA, {RED, GREEN, BLUE, RG, RGB}_INTEGER, void GetNamedBufferParameteri[64]v(
void BindBufferBase(enum target, {RGBA, BGR, BGRA} _INTEGER, STENCIL_INDEX, void FlushMappedNamedBufferRange( uint buffer, enum pname, int[64]*data);
uint index, uint buffer); DEPTH_{COMPONENT, STENCIL} uint buffer, intptr offset, sizeiptr length);
void GetBufferPointerv(enum target,
target: See BindBufferRange boolean UnmapBuffer(enum target); enum pname, const void **params);
void ClearNamedBufferSubData( target: See BindBuffer
uint buffer, enum internalFormat, target: See BindBuffer
void BindBuffersRange(enum target,
uint first, sizei count, const uint *buffers, intptr offset, sizeiptr size, enum format, boolean UnmapNamedBuffer(uint buffer); pname: BUFFER_MAP_POINTER
const intptr *offsets, const sizeiptr *size); enum type, const void *data); void GetNamedBufferPointerv(uint buffer,
internalformat, format, type: See Invalidate Buffer Data [6.5]
target: See BindBufferRange
void InvalidateBufferSubData(uint buffer, enum pname, const void **params);
ClearBufferSubData pname: BUFFER_MAP_POINTER
void BindBuffersBase(enum target, intptr offset, sizeiptr length);
uint first, sizei count, void ClearBufferData(enum target,
enum internalformat, enum format, void InvalidateBufferData(uint buffer); Copy Between Buffers [6.6]
const uint *buffers);
target: See BindBufferRange
enum type, const void *data); void CopyBufferSubData(enum readTarget,
target, internalformat, format: See Buffer Object Queries [6, 6.7] enum writeTarget, intptr readOffset,
Create/Modify Buffer Object Data [6.2] ClearBufferSubData boolean IsBuffer(uint buffer); intptr writeOffset, sizeiptr size);
void BufferStorage(enum target, readTarget and writeTarget: See BindBuffer
void ClearNamedBufferData(uint buffer, void GetBufferSubData(enum target,
sizeiptr size, const void *data, enum internalformat, enum format, intptr offset, sizeiptr size, void *data); void CopyNamedBufferSubData(
bitfield flags); enum type, const void *data); target: See BindBuffer uint readBuffer, uint writeBuffer,
target: See BindBuffer internalformat, format, type: See ClearBufferData intptr readOffset, intptr writeOffset,
flags: Bitwise OR of MAP_{READ, WRITE}_BIT, void GetNamedBufferSubData(uint buffer, sizeiptr size);
{DYNAMIC, CLIENT}_STORAGE_BIT, Map/Unmap Buffer Data [6.3] intptr offset, sizeiptr size, void *data);
MAP_{COHERENT, PERSISTENT}_BIT void *MapBufferRange(enum target,
void NamedBufferStorage(uint buffer, intptr offset, sizeiptr length,
sizeiptr size, const void *data, bitfield access); Shaders and Programs void CompileShader(uint shader);
bitfield flags); target: See BindBuffer void ReleaseShaderCompiler(void);
access: The Bitwise OR of MAP_X_BIT, where X may Shader Objects [7.1-2]
flags: See BufferStorage void DeleteShader(uint shader);
be READ, WRITE, PERSISTENT, COHERENT, uint CreateShader(enum type);
void BufferData(enum target, sizeiptr size, INVALIDATE_{BUFFER, RANGE}, type: boolean IsShader(uint shader);
const void *data, enum usage); FLUSH_EXPLICIT, UNSYNCHRONIZED {COMPUTE, FRAGMENT}_SHADER,
target: See BindBuffer void *MapNamedBufferRange(uint buffer, {GEOMETRY, VERTEX}_SHADER, void ShaderBinary(sizei count,
usage: DYNAMIC_{DRAW, READ, COPY}, intptr offset, sizeiptr length, TESS_{EVALUATION, CONTROL}_SHADER const uint *shaders, enum binaryformat,
{STATIC, STREAM}_{DRAW, READ, COPY} bitfield access); const void *binary, sizei length);
target: See BindBuffer
void ShaderSource(uint shader, sizei count,
void NamedBufferData(uint buffer, sizeiptr const char * const * string,
size, const void *data, enum usage); access: See MapBufferRange const int *length);
(Continued on next page)
©2014 Khronos Group - Rev. 0814 www.opengl.org/registry
Page 2 OpenGL 4.5 API Reference Card
Shaders and Programs (cont.) stages: ALL_SHADER_BITS or the bitwise OR of
TESS_{CONTROL, EVALUATION}_SHADER_BIT,
void
UniformMatrix{2x3,3x2,2x4,4x2,3x4, 4x3}
barriers: ALL_BARRIER_BITS or the OR of
X_BARRIER_BIT where X may be:
Program Objects [7.3] {VERTEX, GEOMETRY, FRAGMENT}_SHADER_BIT, {fd}v( int location, sizei count, ATOMIC_COUNTER, FRAMEBUFFER,
uint CreateProgram(void); COMPUTE_SHADER_BIT boolean transpose, const float *value); SHADER_IMAGE_ACCESS, SHADER_STORAGE,
TEXTURE_FETCH, UNIFORM
void AttachShader(uint program, uint shader); void ActiveShaderProgram(uint pipeline, void ProgramUniform{1234}{i f d}(
uint program); uint program, int location, T value); Shader and Program Queries [7.13]
void DetachShader(uint program, void GetShaderiv(uint shader, enum pname,
uint shader); Program Binaries [7.5] void ProgramUniform{1234}{i f d}v(
uint program, int location, sizei count, int *params);
void LinkProgram(uint program); void GetProgramBinary(uint program,
sizei bufSize, sizei *length, const T *value); pname: SHADER_TYPE, INFO_LOG_LENGTH,
void UseProgram(uint program); enum *binaryFormat, void *binary); {DELETE, COMPILE}_STATUS, COMPUTE_SHADER,
void ProgramUniform{1234}uiv( SHADER_SOURCE_LENGTH
uint CreateShaderProgramv(enum type, void ProgramBinary(uint program, uint program, int location, sizei count,
sizei count, const char * const * strings); enum binaryFormat, const void *binary, const T *value); void GetProgramiv(uint program,
sizei length); enum pname, int *params);
void ProgramParameteri(uint program, void ProgramUniform{1234}ui( pname: ACTIVE_ATOMIC_COUNTER_BUFFERS,
enum pname, int value); Uniform Variables [7.6] uint program, int location, T value); ACTIVE_ATTRIBUTES,
pname: PROGRAM_SEPARABLE, int GetUniformLocation(uint program, void ProgramUniformMatrix{234}{f d}v( ACTIVE_ATTRIBUTE_MAX_LENGTH,
PROGRAM_BINARY_RETRIEVABLE_HINT const char *name); uint program, int location, sizei count, ACTIVE_UNIFORMS, ACTIVE_UNIFORM_BLOCKS,
value: TRUE, FALSE void GetActiveUniformName(uint program, boolean transpose, const T *value); ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH,
void DeleteProgram(uint program); uint uniformIndex, sizei bufSize, ACTIVE_UNIFORM_MAX_LENGTH,
sizei *length, char *uniformName); void ProgramUniformMatrixf{2x3,3x2,2x4, ATTACHED_SHADERS, VALIDATE_STATUS,
boolean IsProgram(uint program); 4x2, 3x4, 4x3}{f d}v( COMPUTE_WORK_GROUP_SIZE, DELETE_STATUS,
void GetUniformIndices(uint program, uint program, int location, sizei count, GEOMETRY_{INPUT, OUTPUT}_TYPE,
Program Interfaces [7.3.1] sizei uniformCount, boolean transpose, const T *value); GEOMETRY_SHADER_INVOCATIONS,
void GetProgramInterfaceiv(uint program, const char * const *uniformNames, GEOMETRY_VERTICES_OUT, INFO_LOG_LENGTH,
uint *uniformIndices); Uniform Buffer Object Bindings
enum programInterface, enum pname, LINK_STATUS, PROGRAM_SEPARABLE,
int *params); void GetActiveUniform(uint program, void UniformBlockBinding(uint program, PROGRAM_BINARY_RETRIEVABLE_HINT,
programInterface: uint index, sizei bufSize, sizei *length, uint uniformBlockIndex, TESS_CONTROL_OUTPUT_VERTICES,
ATOMIC_COUNTER_BUFFER, BUFFER_VARIABLE, int *size, enum *type, char *name); uint uniformBlockBinding); TESS_GEN_{MODE, SPACING},
UNIFORM[_BLOCK], PROGRAM_{INPUT, OUTPUT}, *type returns: DOUBLE_{VECn, MATn, MATmxn}, Shader Buffer Variables [7.8] TESS_GEN_{VERTEX_ORDER, POINT_MODE},
SHADER_STORAGE_BLOCK, DOUBLE, FLOAT_{VECn, MATn, MATmxn}, FLOAT, TRANSFORM_FEEDBACK_BUFFER_MODE,
{GEOMETRY, VERTEX}_SUBROUTINE, INT, INT_VECn, UNSIGNED_INT[_VECn], BOOL,
void ShaderStorageBlockBinding( TRANSFORM_FEEDBACK_VARYINGS,
TESS_{CONTROL, EVALUATION}_SUBROUTINE, BOOL_VECn, or any value in [Table 7.3]
uint program, uint storageBlockIndex, TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH
{FRAGMENT, COMPUTE}_SUBROUTINE, uint storageBlockBinding);
TESS_CONTROL_SUBROUTINE_UNIFORM, void GetActiveUniformsiv(uint program, Subroutine Uniform Variables [7.9] void GetProgramPipelineiv(uint pipeline,
TESS_EVALUATION_SUBROUTINE_UNIFORM, sizei uniformCount, Parameter shadertype for the functions in this enum pname, int *params);
{GEOMETRY, VERTEX}_SUBROUTINE_UNIFORM, const uint *uniformIndices, enum pname, section may be {COMPUTE, VERTEX}_SHADER, pname: ACTIVE_PROGRAM, VALIDATE_STATUS,
{FRAGMENT, COMPUTE}_SUBROUTINE_UNIFORM, int *params); TESS_{CONTROL, EVALUATION}_SHADER, or {VERTEX, FRAGMENT, GEOMETRY}_SHADER,
TRANSFORM_FEEDBACK_{BUFFER, VARYING} pname: [Table 7.6] {FRAGMENT, GEOMETRY}_SHADER TESS_{CONTROL, EVALUATION}_SHADER,
pname: ACTIVE_RESOURCES, MAX_NAME_LENGTH, UNIFORM_{NAME_LENGTH, TYPE, OFFSET}, INFO_LOG_LENGTH, COMPUTE_SHADER
MAX_NUM_ACTIVE_VARIABLES, UNIFORM_{SIZE, BLOCK_INDEX, UNIFORM}, int GetSubroutineUniformLocation(
MAX_NUM_COMPATIBLE_SUBROUTINES UNIFORM_{ARRAY, MATRIX}_STRIDE, uint program, enum shadertype, void GetAttachedShaders(uint program,
UNIFORM_IS_ROW_MAJOR, const char *name); sizei maxCount, sizei *count,
uint GetProgramResourceIndex( UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX
uint *shaders);
uint program, enum programInterface, uint GetSubroutineIndex(uint program,
const char *name); uint GetUniformBlockIndex(uint program, enum shadertype, const char *name); void GetShaderInfoLog(uint shader,
const char *uniformBlockName); sizei bufSize, sizei *length, char *infoLog);
void GetProgramResourceName( void GetActiveSubroutineName(
uint program, enum programInterface, void GetActiveUniformBlockName( uint program, enum shadertype, void GetProgramInfoLog(uint program,
uint index, sizei bufSize, sizei *length, uint program, uint uniformBlockIndex, uint index, sizei bufsize, sizei *length, sizei bufSize, sizei *length, char *infoLog);
char *name);
char *name); sizei bufSize, sizei length, void GetProgramPipelineInfoLog(
char *uniformBlockName); void GetActiveSubroutineUniformName( uint pipeline, sizei bufSize,
void GetProgramResourceiv(uint program, uint program, enum shadertype, sizei *length, char *infoLog);
enum programInterface, uint index, void GetActiveUniformBlockiv( uint index, sizei bufsize, sizei *length,
sizei propCount, const enum *props, uint program, uint uniformBlockIndex, char *name); void GetShaderSource(uint shader,
sizei bufSize, sizei *length, int *params); enum pname, int *params); sizei bufSize, sizei *length, char *source);
*props: [See Table 7.2] pname: UNIFORM_BLOCK_{BINDING, DATA_SIZE}, void GetActiveSubroutineUniformiv(
UNIFORM_BLOCK_NAME_LENGTH, uint program, enum shadertype, void GetShaderPrecisionFormat(
int GetProgramResourceLocation( UNIFORM_BLOCK_ACTIVE_UNIFORMS[_INDICES], uint index, enum pname, int *values); enum shadertype, enum precisiontype,
uint program, enum programInterface, UNIFORM_BLOCK_REFERENCED_BY_X_SHADER, pname: [NUM_]COMPATIBLE_SUBROUTINES int *range, int *precision);
const char *name); where X may be one of VERTEX, FRAGMENT, shadertype: {VERTEX, FRAGMENT}_SHADER
COMPUTE, GEOMETRY, TESS_CONTROL, or void UniformSubroutinesuiv( precisiontype: {LOW, MEDIUM, HIGH}_{FLOAT, INT}
int GetProgramResourceLocationIndex( enum shadertype, sizei count,
uint program, enum programInterface, TESS_EVALUATION [Table 7.7]
const uint *indices); void GetUniform{f d i ui}v(uint program,
const char *name); void GetActiveAtomicCounterBufferiv( Shader Memory Access [7.12.2] int location, T *params);
uint program, uint bufferIndex, See diagram on page 6 for more information.
Program Pipeline Objects [7.4] enum pname, int *params); void GetnUniform{f d i ui}v(uint program,
void GenProgramPipelines(sizei n, pname: See GetActiveUniformBlockiv, however void MemoryBarrier(bitfield barriers); int location, sizei bufSize, T *params);
uint *pipelines); replace the prefix UNIFORM_BLOCK_ with barriers: ALL_BARRIER_BITS or the OR of void GetUniformSubroutineuiv(
void DeleteProgramPipelines(sizei n, ATOMIC_COUNTER_BUFFER_ X_BARRIER_BIT where X may be: QUERY_BUFFER, enum shadertype, int location,
const uint *pipelines); VERTEX_ATTRIB_ARRAY, ELEMENT_ARRAY, uint *params);
Load Uniform Vars. in Default Uniform Block UNIFORM, TEXTURE_FETCH, BUFFER_UPDATE,
boolean IsProgramPipeline(uint pipeline); void Uniform{1234}{i f d ui}(int location, SHADER_IMAGE_ACCESS, COMMAND, void GetProgramStageiv(uint program,
T value); PIXEL_BUFFER, TEXTURE_UPDATE, FRAMEBUFFER, enum shadertype, enum pname,
void BindProgramPipeline(uint pipeline); TRANSFORM_FEEDBACK, ATOMIC_COUNTER, int *values);
void Uniform{1234}{i f d ui}v(int location, SHADER_STORAGE, CLIENT_MAPPED_BUFFER, pname: ACTIVE_SUBROUTINES,
void CreateProgramPipelines(sizei n, sizei count, const T *value);
uint *pipelines); ACTIVE_SUBROUTINE_X where X may be
void MemoryBarrierByRegion(bitfield UNIFORMS, MAX_LENGTH, UNIFORM_LOCATIONS,
void UniformMatrix{234}{f d}v( barriers);
void UseProgramStages(uint pipeline, int location, sizei count, boolean transpose, UNIFORM_MAX_LENGTH
bitfield stages, uint program); const float *value);

Textures and Samplers [8] void BindTextureUnit(uint unit, uint texture); void SamplerParameter{i f}(uint sampler,
enum pname, T param);
Sampler Queries [8.3]
void ActiveTexture(enum texture); void CreateTextures(enum target, sizei n, void GetSamplerParameter{i f}v(
pname: TEXTURE_X where X may be WRAP_{S, T, R}, uint sampler, enum pname, T *params);
texture: TEXTUREi (where i is uint *textures); {MIN, MAG}_FILTER, {MIN, MAX}_LOD,
[0, max(MAX_TEXTURE_COORDS, target: See BindTexture pname: See SamplerParameter{if}
BORDER_COLOR, LOD_BIAS,
MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1]) COMPARE_{MODE, FUNC} [Table 23.18] void GetSamplerParameterI{i ui}v(
void DeleteTextures(sizei n,
Texture Objects [8.1] const uint *textures); uint sampler, enum pname, T *params);
void SamplerParameter{i f}v(uint sampler, pname: See SamplerParameter{if}
void GenTextures(sizei n, uint *textures); boolean IsTexture(uint texture); enum pname, const T *param);
void BindTexture(enum target, uint texture); pname: See SamplerParameter{if} Pixel Storage Modes [8.4.1]
Sampler Objects [8.2] void PixelStore{i f}(enum pname, T param);
target: TEXTURE_{1D, 2D}[_ARRAY], void GenSamplers(sizei count, uint *samplers); void SamplerParameterI{i ui}v(uint sampler,
TEXTURE_{3D, RECTANGLE, BUFFER}, enum pname, const T *params); pname: [Tables 8.1, 18.1] [UN]PACK_X where X may
TEXTURE_CUBE_MAP[_ARRAY], void CreateSamplers(sizei n, uint *samplers); pname: See SamplerParameter{if} be SWAP_BYTES, LSB_FIRST, ROW_LENGTH,
TEXTURE_2D_MULTISAMPLE[_ARRAY] SKIP_{IMAGES, PIXELS, ROWS}, ALIGNMENT,
void BindSampler(uint unit, uint sampler); void DeleteSamplers(sizei count, IMAGE_HEIGHT, COMPRESSED_BLOCK_WIDTH,
void BindTextures(uint first, sizei count, const uint *samplers); COMPRESSED_BLOCK_{HEIGHT, DEPTH, SIZE}
const uint *textures); void BindSamplers(uint first, sizei count,
target: See BindTexture const uint *samplers); boolean IsSampler(uint sampler); (Continued on next page)
©2014 Khronos Group - Rev. 0814 www.opengl.org/registry
OpenGL 4.5 API Reference Card Page 3
Textures and Samplers (cont.) void TextureSubImage1D(uint texture, int level, Buffer Textures [8.9]
int xoffset, sizei width, enum format,
void GetTextureLevelParameter{i f}v(
uint texture, int level, enum pname,
void TexBufferRange(enum target,
Texture Image Spec. [8.5] enum type, const void *pixels); enum internalFormat, uint buffer, T *params);
void TexImage3D(enum target, int level, format, type: See TexImage3D intptr offset, sizeiptr size); pname: See GetTexLevelParameter{i f}v
int internalformat, sizei width, sizei height, void CopyTextureSubImage3D(uint texture,
sizei depth, int border, enum format, void TextureBufferRange(uint texture, void GetTexImage(enum target, int level,
int level, int xoffset, int yoffset, int zoffset, enum internalFormat, uint buffer, enum format, enum type, void *pixels);
enum type, const void *data); int x, int y, sizei width, sizei height); intptr offset, sizeiptr size);
target: [PROXY_]TEXTURE_CUBE_MAP_ARRAY, target: TEXTURE_{1, 2}D[_ARRAY],
internalformat: See TexBuffer TEXTURE_{3D, RECTANGLE, CUBE_MAP_ARRAY},
[PROXY_]TEXTURE_2D_ARRAY, [PROXY_]TEXTURE_3D void CopyTextureSubImage2D(uint texture,
internalformat: STENCIL_INDEX, RED, int level, int xoffset, int yoffset, int x, void TexBuffer(enum target, TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
DEPTH_{COMPONENT, STENCIL}, RG, RGB, RGBA, int y, sizei width, sizei height); enum internalformat, uint buffer); TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z}
COMPRESSED_{RED, RG, RGB, RGBA, SRGB, target: TEXTURE_BUFFER format: See TexImage3D
void CopyTextureSubImage1D(uint texture,
SRGB_ALPHA), a sized internal format from int level, int xoffset, int x, int y, sizei width); internalformat: [Table 8.16] R8, R8{I, UI}, R16, type: [UNSIGNED_]BYTE, SHORT, INT,
[Tables 8.12 - 8.13], or a COMPRESSED_ format R16{F, I, UI}, R32{F, I, UI}, RG8, RG8{I, UI}, RG16, [HALF_]FLOAT, or a value from [Table 8.2]
from [Table 8.14] Compressed Texture Images [8.7] RG16{F, I, UI}, RG32{F, I, UI}, RGB32F, RGB32{I, UI}, void GetTextureImage(uint texture, int level,
format: DEPTH_{COMPONENT, STENCIL}, RED, void CompressedTexImage3D(enum target, RGBA8, RGBA8{I, UI}, RGBA16, RGBA16{F, I, UI}, enum format, enum type, sizei bufSize,
GREEN, BLUE, RG, RGB, RGBA, BGR, BGRA, int level, enum internalformat, sizei width, RGBA32{F, I, UI} void *pixels);
{BGRA, RED, GREEN, BLUE}_INTEGER, sizei height, sizei depth, int border, level: LOD level
{RG, RGB, RGBA, BGR}_INTEGER, sizei imageSize, const void *data); void TextureBuffer(uint texture,
STENCIL_INDEX, [Table 8.3] target: See TexImage3D enum internalformat, uint buffer); format, type: See GetTexImage
type: [UNSIGNED_]{BYTE, SHORT, INT}, internalformat: See TexBuffer void GetnTexImage(enum tex, int level,
internalformat: A COMPRESSED_
[HALF_]FLOAT, or a value from [Table 8.2] format from [Table 8.14] Texture Parameters [8.10] enum format, enum type, sizei bufSize,
void TexImage2D(enum target, int level, void TexParameter{i f}(enum target, void *pixels);
void CompressedTexImage2D(enum target,
int internalformat, sizei width, int level, enum internalformat, enum pname, T param); tex: TEXTURE_{1D, 2D, 3D}[_ARRAY], TEXTURE_3D,
sizei height, int border, enum format, sizei width, sizei height, int border, target: See BindTexture TEXTURE_{CUBE_MAP_ARRAY, RECTANGLE},
enum type, const void *data); sizei imageSize, const void *data); TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z},
target: [PROXY_]TEXTURE_{2D, RECTANGLE}, void TexParameter{i f}v(enum target, TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z}
target: See TexImage2D
[PROXY_]TEXTURE_{1D_ARRAY, CUBE_MAP}, enum pname, const T *params); level, format, type: See GetTextureImage
internalformat: May be one of the COMPRESSED_
TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z}, target: See BindTexture
formats from [Table 8.14] void GetTextureSubImage(uint texture,
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z} void TexParameterI{i ui}v(enum target, int level, int xoffset, int yoffset, int zoffset,
internalformat, format, type: See TexImage3D void CompressedTexImage1D(enum target,
int level, enum internalformat, enum pname, const T *params); sizei width, sizei height, sizei depth,
void TexImage1D(enum target, int level, sizei width, int border, sizei imageSize, target: See BindTexture enum format, enum type, sizei bufSize,
int internalformat, sizei width, int border, const void *data); void *pixels);
pname: DEPTH_STENCIL_TEXTURE_MODE or
enum format, enum type, const void *data); target: TEXTURE_1D, PROXY_TEXTURE_1D TEXTURE_X where X may be one of level, format, type: See GetTextureImage
target: TEXTURE_1D, PROXY_TEXTURE_1D internalformat: See TexImage1D, omitting WRAP_{S, T, R}, BORDER_COLOR, void GetCompressedTexImage(enum target,
type, internalformat, format: See TexImage3D compressed rectangular texture formats {MIN, MAG}_FILTER, LOD_BIAS,{MIN, MAX}_LOD, int level, void *pixels);
{BASE, MAX}_LEVEL, SWIZZLE_{R, G, B, A, RGBA}, target: See GetTextureImage
Alternate Texture Image Spec. [8.6] void CompressedTexSubImage3D( COMPARE_{MODE, FUNC} [Table 8.17]
enum target, int level, int xoffset, void
void CopyTexImage2D(enum target, int yoffset, int zoffset, sizei width, void TextureParameter{i f}(uint texture,
int level, enum internalformat, int x, GetCompressedTextureImage(uint texture,
sizei height, sizei depth, enum format, enum pname, T param); int level, sizei bufSize, void *pixels);
int y, sizei width, sizei height, int border); sizei imageSize, const void *data); pname: See BindTexture
target: TEXTURE_{2D, RECTANGLE, 1D_ARRAY}, level: See GetTextureImage
target: See TexSubImage3D
TEXTURE_CUBE_MAP_{POSITIVE, NEGATIVE}_{X, Y, Z} format: See internalformat for void TextureParameter{i f}v(uint texture, void GetnCompressedTexImage(enum target,
internalformat: See TexImage3D CompressedTexImage3D enum pname, const T *params); int level, sizei bufsize, void *pixels);
void CopyTexImage1D(enum target, void CompressedTexSubImage2D( pname: See BindTexture target: See GetCompressedTexImage
int level, enum internalformat, int x, enum target, int level, int xoffset, level: LOD level
void TextureParameterI{i ui}v(uint texture,
int y, sizei width, int border); int yoffset, sizei width, sizei height, enum pname, const T *params); void GetCompressedTextureSubImage(
target: TEXTURE_1D enum format, sizei imageSize, pname: TEXTURE_3D, TEXTURE_{1D, 2D}[_ARRAY], uint texture, int level, int xoffset, int yoffset,
internalformat: See TexImage3D cont void *data); int zoffset, sizei width, sizei height,
TEXTURE_CUBE_MAP[_ARRAY],
target: See TexSubImage2D sizei depth, sizei bufSize, void *pixels);
void TexSubImage3D(enum target, int level, TEXTURE_RECTANGLE,
format: See internalformat for
int xoffset, int yoffset, int zoffset, CompressedTexImage2D TEXTURE_2D_MULTISAMPLE[_ARRAY] level: LOD level
sizei width, sizei height, sizei depth, void CompressedTexSubImage1D( Texture Queries [8.11] Cube Map Texture Select [8.13.1]
enum format, enum type, enum target, int level, int xoffset,
const void *data); void GetTexParameter{if}v(enum target, Enable/Disable/IsEnabled(
sizei width, enum format, sizei imageSize, enum pname, T * params); TEXTURE_CUBE_MAP_SEAMLESS);
target: TEXTURE_3D, TEXTURE_2D_ARRAY, const void *data);
TEXTURE_CUBE_MAP_ARRAY target: See BindTexture
target: See TexSubImage1D pname: See GetTexParameterI{i ui}v
Manual Mipmap Generation [8.14.4]
format, type: See TexImage3D format: See internalformat for void GenerateMipmap(enum target);
void TexSubImage2D(enum target, CompressedTexImage1D void GetTexParameterI{i ui}v(enum target, target: TEXTURE_{1D, 2D, 3D},
int level, int xoffset, int yoffset, sizei width, enum pname, T * params); TEXTURE_{1D, 2D}_ARRAY,
void CompressedTextureSubImage3D(
sizei height, enum format, enum type, uint texture, int level, int xoffset, target: See BindTexture TEXTURE_CUBE_MAP[_ARRAY]
const void *data); int yoffset, int zoffset, sizei width, pname: IMAGE_FORMAT_COMPATIBILITY_TYPE, void GenerateTextureMipmap(uint texture);
target: See CopyTexImage2D sizei height, sizei depth, enum format, TEXTURE_IMMUTABLE_{FORMAT, LEVELS},
format, type: See TexImage3D sizei imageSize, const void *data); TEXTURE_VIEW_MIN_{LEVEL, LAYER}, Texture Views [8.18]
format: See internalformat for TEXTURE_VIEW_NUM_{LEVELS, LAYERS}, void TextureView(uint texture, enum target,
void TexSubImage1D(enum target, int level, DEPTH_STENCIL_TEXTURE_MODE, or TEXTURE_X
int xoffset, sizei width, enum format, CompressedTexImage3D
where X may be one of WRAP_{S, T, R},
uint origtexture, enum internalformat,
enum type, const void *data); void CompressedTextureSubImage2D( BORDER_COLOR, TARGET, {MIN, MAG}_FILTER,
uint minlevel, uint numlevels, uint minlayer,
target, format, type: See CopyTexImage1D uint texture, int level, int xoffset, LOD_BIAS,{MIN, MAX}_LOD, {BASE, MAX}_LEVEL, uint numlayers);
int yoffset, sizei width, sizei height, SWIZZLE_{R, G, B, A, RGBA}, target: TEXTURE_{1D, 2D,CUBE_MAP}[_ARRAY],
void CopyTexSubImage3D(enum target, enum format, sizei imageSize, COMPARE_{MODE, FUNC} [Table 8.17] TEXTURE_3D, TEXTURE_RECTANGLE,
int level, int xoffset, int yoffset, int zoffset, cont void *data); TEXTURE_2D_MULTISAMPLE[_ARRAY]
int x, int y, sizei width, sizei height); format: See internalformat for void GetTextureParameter{if}v(uint texture, internalformat:
target: See TexSubImage3D CompressedTexImage2D enum pname, T *data); R8, R8{UI, I}, R8_SNORM, R11F_G11F_B10F,
void CopyTexSubImage2D(enum target, pname: See GetTexParameterI{i ui}v R16{F, UI, I}, R16[_SNORM],
void CompressedTextureSubImage1D( R32{F, UI, I}, SRGB8[UI, I],
int level, int xoffset, int yoffset, int x, uint texture, int level, int xoffset, void GetTextureParameterI{i ui}v(uint texture, RG8{F, UI, I}, RG8[_SNORM],
int y, sizei width, sizei height); sizei width, enum format, sizei imageSize, enum pname, T *data); RG16{F, UI, I}, RG16[_SNORM], RG32{F, UI, I},
target: See TexImage2D const void *data); RGB8[_SNORM], RGB9_E5, RGB10_A2[UI],
pname: See GetTexParameterI{i ui}v
void CopyTexSubImage1D(enum target, format: See internalformat for RGBA8{UI, I}, RGBA8[_SNORM],
int level, int xoffset, int x, int y, sizei width); CompressedTexImage1D void GetTexLevelParameter{i f}v(enum target, RGB16{F, UI, I}, RGB16[_SNORM], RGB32{F, UI, I},
target: See TexSubImage1D Multisample Textures [8.8] int level, enum pname, T *params); RGBA16{F, UI, I}, RGBA16[_SNORM],
target: [PROXY_]TEXTURE_{1D, 2D, 3D}, RGBA32{F, UI, I}, SRGB8_ALPHA8;
void TextureSubImage3D(uint texture, int level, void TexImage3DMultisample(enum target, TEXTURE_BUFFER, PROXY_TEXTURE_CUBE_MAP, COMPRESSED_X where X may be
int xoffset, int yoffset, int zoffset, sizei samples, int internalformat, [PROXY_]TEXTURE_{1D, 2D,CUBE_MAP}_ARRAY, [SIGNED]_RED_RGTC1, [SIGNED]_RG_RGTC2,
sizei width, sizei height, sizei depth, sizei width, sizei height, sizei depth, [PROXY_]TEXTURE_RECTANGLE, {RGBA, SRGB_ALPHA}_BPTC_UNORM,
enum format, enum type, boolean fixedsamplelocations); RGB_BPTC_[UN]SIGNED_FLOAT
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
const void *pixels); target: [PROXY_]TEXTURE_2D_MULTISAMPLE_ARRAY
TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z},
format, type: See TexImage3D internalformat: RED, RG, RGB, RGBA, RGBA{32, 32UI}, [PROXY_]TEXTURE_2D_MULTISAMPLE[_ARRAY] Immutable-Format Tex. Images [8.19]
DEPTH_COMPONENT[16, 24, 32, 32F], void TexStorage1D(enum target, sizei levels,
void TextureSubImage2D(uint texture, int level, DEPTH{24, 32F}_STENCIL8, STENCIL_INDEX{1, 4, 8, 16} pname: TEXTURE _*, where * may be WIDTH,
HEIGHT, DEPTH, FIXED_SAMPLE_LOCATIONS, enum internalformat, sizei width);
int xoffset, int yoffset, sizei width, void TexImage2DMultisample(enum target, target: TEXTURE_1D
sizei height, enum format, enum type, INTERNAL_FORMAT, SHARED_SIZE, COMPRESSED,
sizei samples, int internalformat, sizei width, COMPRESSED_IMAGE_SIZE, SAMPLES, internalformat: any of the sized internal color, depth,
const void *pixels); sizei height, boolean fixedsamplelocations); BUFFER_{OFFSET, SIZE}, or X_{SIZE, TYPE} and stencil formats in [Tables 8.18-20]
format, type: See TexImage3D target: [PROXY_]TEXTURE_2D_MULTISAMPLE where X can be RED, GREEN, BLUE, ALPHA, DEPTH
internalformat: See TexImage3DMultisample (Continued on next page)

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


Page 4 OpenGL 4.5 API Reference Card
Textures and Samplers (cont.) void TextureStorage3D(uint texture,
sizei levels, enum internalformat,
void TextureStorage3DMultisample(
uint texture, sizei samples,
void ClearTexImage(uint texture,
int level, enum format, enum type,
void TexStorage2D(enum target, sizei levels, sizei width, sizei height, sizei depth); enum internalformat, sizei width, const void *data);
enum internalformat, sizei width, internalformat: See TexStorage1D sizei height, sizei depth,
sizei height); format, type: See TexImage3D, pg 2 this card
boolean fixedsamplelocations);
target: TEXTURE_{RECTANGLE, CUBE_MAP}, void TexStorage2DMultisample( Texture Image Loads/Stores [8.26]
TEXTURE_{1D_ARRAY, 2D} enum target, sizei samples, Invalidate Texture Image Data [8.20]
enum internalformat, sizei width, void BindImageTexture(uint index,
internalformat: See TexStorage1D texture,
sizei height, boolean fixedsamplelocations); voidintInvalidateTexSubImage(uint
level, int xoffset, int yoffset, int zoffset,
uint texture, int level, boolean layered,
void TexStorage3D(enum target, sizei levels, target: TEXTURE_2D_MULTISAMPLE int layer, enum access, enum format);
enum internalformat, sizei width, sizei width, sizei height, sizei depth); access: READ_ONLY, WRITE_ONLY, READ_WRITE
sizei height, sizei depth); void TexStorage3DMultisample( format: RGBA{32,16}F, RG{32,16}F, R11F_G11F_B10F,
target: TEXTURE_3D, enum target, sizei samples, void InvalidateTexImage(uint texture, int level);
R{32,16}F, RGBA{32,16,8}UI, RGB10_A2UI,
TEXTURE_{CUBE_MAP, 2D}[_ARRAY] enum internalformat, sizei width, Clear Texture Image Data [8.21] RG{32,16,8}UI, R{32,16,8}UI, RGBA{32,16,8}I,
internalformat: See TexStorage1D sizei height, sizei depth, RG{32,16,8}I, R{32,16,8}I, RGBA{16,8}, RGB10_A2,
boolean fixedsamplelocations); void ClearTexSubImage(uint texture,
void TextureStorage1D(uint texture, sizei levels, target: TEXTURE_2D_MULTISAMPLE_ARRAY int level, int xoffset, int yoffset, int zoffset, RG{16,8}, R{16,8}, RGBA{16,8}_SNORM,
enum internalformat, sizei width); sizei width, sizei height, sizei depth, RG{16,8}_SNORM, R{16,8}_SNORM [Table 8.26]
internalformat: See TexStorage1D void TextureStorage2DMultisample( enum format, enum type, const void *data);
uint texture, sizei samples, void BindImageTextures(uint first,
void TextureStorage2D(uint texture, format, type: See TexImage3D, pg 2 this card sizei count, const uint *textures);
enum internalformat, sizei width,
sizei levels, enum internalformat, sizei height, boolean fixedsamplelocations);
sizei width, sizei height);
internalformat: See TexStorage1D

Framebuffer Objects attachment: DEPTH, FRONT_{LEFT, RIGHT}, STENCIL, void NamedRenderbufferStorage(


BACK_{LEFT, RIGHT}, COLOR_ATTACHMENTi, uint renderbuffer, enum internalformat,
void NamedFramebufferTexture(
uint framebuffer, enum attachment,
Binding and Managing [9.2] {DEPTH, STENCIL, DEPTH_STENCIL}_ATTACHMENT sizei width, sizei height); uint texture, int level);
void BindFramebuffer(enum target, pname: FRAMEBUFFER_ATTACHMENT_ X where X internalformat: See TexImage3DMultisample attachment: See FramebufferRenderbuffer
uint framebuffer); may be OBJECT_{TYPE, NAME}, COMPONENT_TYPE, void FramebufferTexture1D(enum target,
target: [DRAW_, READ_]FRAMEBUFFER {RED, GREEN, BLUE, ALPHA, DEPTH, STENCIL}_SIZE, Renderbuffer Object Queries [9.2.6] enum attachment, enum textarget,
COLOR_ENCODING, TEXTURE_{LAYER, LEVEL}, void GetRenderbufferParameteriv( uint texture, int level);
void CreateFramebuffers(sizei n, LAYERED, TEXTURE_CUBE_MAP_FACE enum target, enum pname, int *params); textarget: TEXTURE_1D
uint *framebuffers); target, attachment: See FramebufferRenderbuffer
void GetNamedFramebufferAttachment- target: RENDERBUFFER
void GenFramebuffers(sizei n, Parameteriv(uint framebuffer, pname: [Table 23.27] void FramebufferTexture2D(enum target,
uint *framebuffers); enum attachment, enum pname, RENDERBUFFER_X where X may be WIDTH, enum attachment, enum textarget,
void DeleteFramebuffers(sizei n, int *params); HEIGHT, INTERNAL_FORMAT, SAMPLES, uint texture, int level);
const uint *framebuffers); attachment, pname: See GetFramebufferParameteriv {RED, GREEN, BLUE, ALPHA, DEPTH, STENCIL}_SIZE textarget: TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z},
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
boolean IsFramebuffer(uint framebuffer); Renderbuffer Objects [9.2.4] void GetNamedRenderbufferParameteriv( TEXTURE_{2D, RECTANGLE, 2D_MULTISAMPLE}
void BindRenderbuffer(enum target, uint renderbuffer, enum pname, (unspecified if texture is 0)
Framebuffer Object Parameters [9.2.1] uint renderbuffer); int *params); target, attachment: See FramebufferRenderbuffer
void FramebufferParameteri( target: RENDERBUFFER pname: See GetRenderbufferParameteriv
enum target, enum pname, int param); void FramebufferTexture3D(enum target,
target: [DRAW_, READ_]FRAMEBUFFER void {Create, Gen}Renderbuffers(sizei n, Attaching Renderbuffer Images [9.2.7] enum attachment, enum textarget,
uint *renderbuffers); void FramebufferRenderbuffer( uint texture, int level, int layer);
pname: FRAMEBUFFER_DEFAULT_X where X may
be WIDTH, HEIGHT, FIXED_SAMPLE_LOCATIONS, enum target, enum attachment, textarget: TEXTURE_3D (unspecified if texture is 0)
void DeleteRenderbuffers(sizei n, enum renderbuffertarget, target, attachment: See FramebufferRenderbuffer
SAMPLES, LAYERS const uint *renderbuffers); uint renderbuffer);
void NamedFramebufferParameteri( target: [DRAW_, READ_]FRAMEBUFFER void FramebufferTextureLayer(enum target,
boolean IsRenderbuffer(uint renderbuffer); enum attachment, uint texture,
uint framebuffer, enum pname, int param); attachment: [Table 9.1]
pname: See FramebufferParameteri void RenderbufferStorageMultisample( int level, int layer);
{DEPTH, STENCIL, DEPTH_STENCIL}_ATTACHMENT,
enum target, sizei samples, COLOR_ATTACHMENTi where i is target, attachment: See FramebufferRenderbuffer
Framebuffer Object Queries [9.2.3] enum internalformat, sizei width, [0, MAX_COLOR_ATTACHMENTS - 1] void NamedFramebufferTextureLayer(
void GetFramebufferParameteriv( sizei height); renderbuffertarget: RENDERBUFFER if renderbuffer is uint framebuffer, enum attachment,
enum target, enum pname, int *params); target: RENDERBUFFER non-zero, else undefined uint texture, int level, int layer);
target: See FramebufferParameteri internalformat: See TexImage3DMultisample attachment: See FramebufferRenderbuffer
pname: See FramebufferParameteri plus void NamedFramebufferRenderbuffer(
DOUBLEBUFFER, SAMPLES, SAMPLE_BUFFERS, void uint framebuffer, enum attachment, Feedback Loops [9.3.1]
IMPLEMENTATION_COLOR_READ_FORMAT, NamedRenderbufferStorageMultisample( enum renderbuffertarget,
uint renderbuffer); void TextureBarrier(void);
IMPLEMENTATION_COLOR_READ_TYPE, STEREO uint renderbuffer, sizei samples,
enum internalformat, sizei width, attachment, renderbuffertarget: See Framebuffer Completeness [9.4.2]
void GetNamedFramebufferParameteriv( sizei height); FramebufferRenderbuffer
uint framebuffer, enum pname, int enum CheckFramebufferStatus(enum target);
internalformat: See TexImage3DMultisample target: [DRAW_, READ_]FRAMEBUFFER
*params); Attaching Texture Images [9.2.8]
pname: See GetFramebufferParameteri void RenderbufferStorage(enum target, void FramebufferTexture(enum target, returns: FRAMEBUFFER_COMPLETE or a constant
enum internalformat, sizei width, enum attachment, uint texture, int level); indicating the violating value
void GetFramebufferAttachmentParameteriv( sizei height);
enum target, enum attachment, target: [DRAW_, READ_]FRAMEBUFFER enum CheckNamedFramebufferStatus(
enum pname, int *params); target: RENDERBUFFER attachment: See FramebufferRenderbuffer uint framebuffer, enum target);
target: [DRAW_, READ_]FRAMEBUFFER internalformat: See TexImage3DMultisample target: See CheckFramebufferStatus

Vertices void VertexAttrib{1234}{s f d}(uint index,


T values);
void VertexAttribI{1234}{i ui}(uint index,
T values);
void VertexAttribP{1234}ui(uint index,
enum type, boolean normalized, uint value);
Separate Patches [10.1.15]
void VertexAttrib{123}{s f d}v(uint index, void VertexAttribI{1234}{i ui}v(uint index, void VertexAttribP{1234}uiv(uint index,
void PatchParameteri(enum pname, int value); const T *values); const T *values); enum type, boolean normalized,
pname: PATCH_VERTICES const uint *value);
void VertexAttrib4{b s i f d ub us ui}v( void VertexAttribI4{b s ub us}v(uint index,
Current Vertex Attribute Values [10.2] uint index, const T *values); const T *values); type: [UNSIGNED_]INT_2_10_10_10_REV, or
Use the commands VertexAttrib*for attributes UNSIGNED_INT_10F_11F_11F_REV (except for
void VertexAttrib4Nub(uint index, ubyte x, void VertexAttribL{1234}d(uint index, VertexAttribP4uiv)
of type float, VertexAttribI* for int or uint, or ubyte y, ubyte z, ubyte w); const T values);
VertexAttribL* for double.
void VertexAttrib4N{b s i ub us ui}v( void VertexAttribL{1234}dv(uint index,
uint index, const T *values); const T *values);

Vertex Arrays Generic Vertex Attribute Arrays [10.3.2] void VertexArrayAttribFormat(uint vaobj,
void VertexAttribFormat(uint attribindex, uint attribindex, int size, enum type,
void VertexArrayVertexBuffer(uint vaobj,
uint bindingindex, uint buffer, intptr offset,
Vertex Array Objects [10.3.1] int size, enum type, boolean normalized, boolean normalized, uint relativeoffset); sizei stride);
All states related to definition of data used by unit relativeoffset); type: See VertexAttribFormat
vertex processor is in a vertex array object. type: [UNSIGNED_]BYTE, [UNSIGNED_]SHORT, void BindVertexBuffers(uint first,
[UNSIGNED_]INT, [HALF_]FLOAT, DOUBLE, FIXED, void VertexArrayAttribIFormat(uint vaobj, sizei count, const uint *buffers,
void GenVertexArrays(sizei n, uint *arrays); uint attribindex, int size, enum type, const intptr *offsets, const sizei *strides);
[UNSIGNED_]INT_2_10_10_10_REV,
void DeleteVertexArrays(sizei n, UNSIGNED_INT_10F_11F_11F_REV uint relativeoffset); void VertexArrayVertexBuffers(uint vaobj,
const uint *arrays); type: See VertexAttribIFormat
uint first, sizei count, const uint *buffers,
void VertexAttribIFormat(uint attribindex,
void BindVertexArray(uint array); int size, enum type, unit relativeoffset); void VertexArrayAttribLFormat(uint vaobj, const intptr *offsets, const sizei *strides);
void CreateVertexArrays(sizei n, uint *arrays); type: [UNSIGNED_]BYTE, [UNSIGNED_]SHORT, uint attribindex, int size, enum type, void VertexAttribBinding(uint attribindex,
[UNSIGNED_]INT uint relativeoffset); uint bindingindex);
boolean IsVertexArray(uint array); type: See VertexAttribLFormat
void VertexAttribLFormat(uint attribindex,
void VertexArrayElementBuffer(uint vaobj, int size, enum type, unit relativeoffset); void BindVertexBuffer(uint bindingindex,
uint buffer); type: DOUBLE uint buffer, intptr offset, sizei stride); (Continued on next page)

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


OpenGL 4.5 API Reference Card Page 5
Vertex Arrays (cont.) Drawing Commands [10.4] void MultiDrawElements(enum mode,
const sizei *count, enum type,
Vertex Array Queries [10.5]
For all the functions in this section: void GetVertexArrayiv(uint vaobj,
void VertexArrayAttribBinding(uint vaobj, mode: POINTS, PATCHES, const void * const *indices, enum pname, int *param);
uint attribindex, uint bindingindex); LINE_STRIP, LINE_LOOP, sizei drawcount); pname: ELEMENT_ARRAY_BUFFER_BINDING
void VertexAttribPointer(uint index, int size, TRIANGLE_STRIP, TRIANGLE_FAN, void DrawRangeElements(enum mode,
LINES, LINES_ADJACENCY, void GetVertexArrayIndexdiv(uint vaobj,
enum type, boolean normalized, uint start, uint end, sizei count, uint index, enum pname, int *param);
sizei stride, const void *pointer); TRIANGLES, TRIANGLES_ADJACENCY, enum type, const void *indices);
LINE_STRIP_ADJACENCY, pname: VERTEX_ATTRIB_RELATIVE_OFFSET or
type: See VertexAttribFormat VERTEX_ATTRIB_ARRAY_X where X is one of
TRIANGLE_STRIP_ADJACENCY void DrawElementsBaseVertex(enum mode, ENABLED, SIZE, STRIDE, TYPE, NORMALIZED,
void VertexAttribIPointer(uint index, type: UNSIGNED_{BYTE, SHORT, INT} sizei count, enum type, const void *indices,
int size, enum type, sizei stride, INTEGER, LONG, DIVISOR
int basevertex);
const void *pointer); void DrawArrays(enum mode, int first, void GetVertexArrayIndexd64iv(uint vaobj,
type: See VertexAttribIFormat sizei count); void DrawRangeElementsBaseVertex( uint index, enum pname, int64 *param);
enum mode, uint start, uint end,
index: [0, MAX_VERTEX_ATTRIBS - 1] void DrawArraysInstancedBaseInstance( sizei count, enum type, const void *indices, pname: VERTEX_BINDING_OFFSET
enum mode, int first, sizei count, int basevertex);
void VertexAttribLPointer(uint index, int size, sizei instancecount, uint baseinstance); void GetVertexAttrib{d f i}v(uint index,
enum type, sizei stride, const void*pointer); enum pname, T *params);
void DrawArraysInstanced(enum mode, void DrawElementsInstancedBaseVertex(
type: DOUBLE enum mode, sizei count, enum type, pname: See GetVertexArrayIndexediv plus
int first, sizei count, sizei instancecount); VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
void EnableVertexAttribArray(uint index); const void *indices, sizei instancecount, VERTEX_ATTRIB_BINDING,
void DrawArraysIndirect(enum mode, int basevertex); CURRENT_VERTEX_ATTRIB
void EnableVertexArrayAttrib(uint vaobj,
uint index); const void *indirect); void DrawElementsInstancedBase-
VertexBaseInstance(enum mode, void GetVertexAttribI{i ui}v(uint index,
void DisableVertexAttribArray(uint index); void MultiDrawArrays(enum mode, enum pname, T *params);
const int *first, const sizei *count, sizei count, enum type,
void DisableVertexArrayAttrib(uint vaobj, const void *indices, sizei instancecount, pname: See GetVertexAttrib{d f i}v
sizei drawcount);
uint index); int basevertex, uint baseinstance); void GetVertexAttribLdv(uint index,
void MultiDrawArraysIndirect(enum mode, enum pname, double *params);
Vertex Attribute Divisors [10.3.4] const void *indirect, sizei drawcount, void DrawElementsIndirect(enum mode,
enum type, const void *indirect); pname: See GetVertexAttrib{d f i}v
void VertexBindingDivisor(uint bindingindex, sizei stride);
uint divisor); void DrawElements(enum mode, sizei count, void MultiDrawElementsIndirect( void GetVertexAttribPointerv(uint index,
void VertexArrayBindingDivisor(uint vaobj, enum type, const void *indices); enum mode, enum type, enum pname, const void **pointer);
uint bindingindex, uint divisor); const void *indirect, sizei drawcount, pname: VERTEX_ATTRIB_ARRAY_POINTER
void DrawElementsInstancedBaseInstance( sizei stride);
void VertexAttribDivisor(uint index, enum mode, sizei count, enum type, Conditional Rendering [10.9]
uint divisor); const void *indices, sizei instancecount, void MultiDrawElementsBaseVertex( void BeginConditionalRender(uint id,
uint baseinstance); enum mode, const sizei *count, enum mode);
Primitive Restart [10.3.6] enum type, const void *const *indices,
void DrawElementsInstanced(enum mode, mode: QUERY _[NO_]WAIT[_INVERTED],
Enable/Disable/IsEnabled(target); sizei drawcount, const int *basevertex); QUERY_BY_REGION_[NO_]WAIT[_INVERTED]
target: PRIMITIVE_RESTART[_FIXED_INDEX] sizei count, enum type, const void *indices,
void PrimitiveRestartIndex(uint index); sizei instancecount); void EndConditionalRender(void);

Vertex Attributes [11.1.1] int GetAttribLocation(uint program,


const char *name);
void GetTransformFeedbackVarying(
uint program, uint index, sizei bufSize,
Shader Execution [11.1.3]
Vertex shaders operate on array of void ValidateProgram(uint program);
4-component items numbered from slot 0 to sizei *length, sizei *size, enum *type,
Transform Feedback Variables [11.1.2] char *name); void ValidateProgramPipeline(uint pipeline);
MAX_VERTEX_ATTRIBS - 1. void TransformFeedbackVaryings( *type returns NONE, FLOAT , FLOAT_VECn, Tessellation Prim. Generation [11.2.2]
void BindAttribLocation(uint program, uint program, sizei count, DOUBLE , DOUBLE_VECn, INT, UNSIGNED_INT,
uint index, const char *name); const char * const *varyings, INT_VECn, UNSIGNED_INT_VECn, void PatchParameterfv(enum pname,
enum bufferMode); MATnxm, FLOAT_MATnxm, DOUBLE_MATnxm, const float *values);
void GetActiveAttrib(uint program, bufferMode: FLOAT_MATn, DOUBLE_MATn pname: PATCH_DEFAULT_INNER_LEVEL,
uint index, sizei bufSize, sizei *length, INTERLEAVED_ATTRIBS, SEPARATE_ATTRIBS PATCH_DEFAULT_OUTER_LEVEL
int *size, enum *type, char *name);

Vertex Post-Processing [13] void EndTransformFeedback(void); void DrawTransformFeedbackStream(


enum mode, uint id, uint stream);
Controlling Viewport [13.6.1]
Transform Feedback [13.2] void PauseTransformFeedback(void); void DepthRangeArrayv(uint first,
void sizei count, const double *v);
void GenTransformFeedbacks(sizei n, void ResumeTransformFeedback(void);
uint *ids); DrawTransformFeedbackStreamInstanced( void DepthRangeIndexed(uint index,
void TransformFeedbackBufferRange( enum mode, uint id, uint stream, double n, double f);
void DeleteTransformFeedbacks(sizei n, uint xfb, uint index, uint buffer, intptr offset, sizei instancecount);
const uint *ids); sizeiptr size); void DepthRange(double n, double f);
Flatshading [13.4]
boolean IsTransformFeedback(uint id); void TransformFeedbackBufferBase( void ProvokingVertex(enum provokeMode); void DepthRangef(float n, float f);
void BindTransformFeedback( uint xfb, uint index, uint buffer); provokeMode: {FIRST, LAST}_VERTEX_CONVENTION void ViewportArrayv(uint first, sizei count,
enum target, uint id); Transform Feedback Drawing [13.2.3] const float *v);
Primitive Clipping [13.5]
target: TRANSFORM_FEEDBACK void ViewportIndexedf(uint index, float x,
void DrawTransformFeedback( Enable/Disable/IsEnabled(target);
void CreateTransformFeedbacks( enum mode, uint id); target: DEPTH_CLAMP, CLIP_DISTANCEi where float y, float w, float h);
sizei n, uint *ids); mode: See Drawing Commands [10.4] above i = [0..MAX_CLIP_DISTANCES - 1] void ViewportIndexedfv(uint index,
void BeginTransformFeedback( void DrawTransformFeedbackInstanced( void ClipControl(enum origin, enum depth); const float *v);
enum primitiveMode); enum mode, uint id, sizei instancecount); origin: LOWER_LEFT or UPPER_LEFT void Viewport(int x, int y, sizei w, sizei h);
primitiveMode: TRIANGLES, LINES, POINTS depth: NEGATIVE_ONE_TO_ONE or ZERO_TO_ONE

Rasterization [13.4, 14] void PointParameter{i f}v(enum pname,


const T *params);
void FrontFace(enum dir);
dir: CCW, CW
Fragment Shaders [15.2]
Enable/Disable/IsEnabled(target); pname: POINT_FADE_THRESHOLD_SIZE, void BindFragDataLocationIndexed(
target: RASTERIZER_DISCARD POINT_SPRITE_COORD_ORIGIN void CullFace(enum mode); uint program, uint colorNumber,
params: The fade threshold if pname is mode: FRONT, BACK, FRONT_AND_BACK uint index, const char *name);
Multisampling [14.3.1] POINT_FADE_THRESHOLD_SIZE;
Use to antialias points, and lines. Polygon Rast. & Depth Offset [14.6.4-5] void BindFragDataLocation(uint program,
{LOWER, UPPER}_LEFT if pname is uint colorNumber, const char *name);
Enable/Disable/IsEnabled(target); POINT_SPRITE_COORD_ORIGIN void PolygonMode(enum face, enum mode);
target: MULTISAMPLE, SAMPLE_SHADING face: FRONT_AND_BACK int GetFragDataLocation(uint program,
Enable/Disable/IsEnabled(target); const char *name);
void GetMultisamplefv(enum pname, mode: POINT, LINE, FILL
target: PROGRAM_POINT_SIZE
uint index, float *val); void PolygonOffset(float factor, float units); int GetFragDataIndex(uint program,
pname: SAMPLE_POSITION Line Segments [14.5] const char *name);
Enable/Disable/IsEnabled(target); Enable/Disable/IsEnabled(target);
void MinSampleShading(float value); target: LINE_SMOOTH target: POLYGON_OFFSET_{POINT, LINE, FILL}
Points [14.4] void LineWidth(float width); Compute Shaders [19]
void PointSize(float size); void DispatchCompute(uint num_groups_x,
Polygons [14.6, 14.6.1] uint num_groups_y, uint num_groups_z);
void PointParameter{i f}(enum pname, Enable/Disable/IsEnabled(target);
T param); void DispatchComputeIndirect(
target: POLYGON_SMOOTH, CULL_FACE
pname, param: See PointParameter{if}v intptr indirect);

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


Page 6 OpenGL 4.5 API Reference Card
Per-Fragment Operations void StencilFunc(enum func, int ref,
uint mask);
Blending [17.3.8] void BlendFunci(uint buf, enum src, enum dst);
src, dst: See BlendFuncSeparate
Scissor Test [17.3.2] Enable/Disable/IsEnabled(BLEND);
func: NEVER, ALWAYS, LESS, GREATER, EQUAL,
Enable/Disable/IsEnabled(SCISSOR_TEST); LEQUAL, GEQUAL, NOTEQUAL Enablei/Disablei/IsEnabledi(BLEND, void BlendFuncSeparatei(uint buf,
uint index); enum srcRGB, enum dstRGB,
Enablei/Disablei/IsEnabledi(SCISSOR_TEST, void StencilFuncSeparate(enum face, enum srcAlpha, enum dstAlpha);
uint index); enum func, int ref, uint mask); void BlendEquation(enum mode); dstRGB, dstAlpha, srcRGB, srcAlpha:
void ScissorArrayv(uint first, sizei count, func: See StencilFunc void BlendEquationSeparate(enum modeRGB, See BlendFuncSeparate
const int *v); void StencilOp(enum sfail, enum dpfail, enum modeAlpha); void BlendColor(float red, float green, float blue,
enum dppass); modeRGB, modeAlpha: MIN, MAX , float alpha);
void ScissorIndexed(uint index, int left, FUNC_{ADD, SUBTRACT, REVERSE_SUBTRACT}
int bottom, sizei width, sizei height); void StencilOpSeparate(enum face,
void BlendEquationi(uint buf, enum mode); Dithering [17.3.10]
void ScissorIndexedv(uint index, int *v); enum sfail, enum dpfail, enum dppass); Enable/Disable/IsEnabled(DITHER);
face: FRONT, BACK, FRONT_AND_BACK void BlendEquationSeparatei(uint buf,
void Scissor(int left, int bottom, sizei width, sfail, dpfail, dppass: KEEP, ZERO, REPLACE, INCR, enum modeRGB, enum modeAlpha); Logical Operation [17.3.11]
sizei height); DECR, INVERT, INCR_WRAP, DECR_WRAP modeRGB, modeAlpha: Enable/Disable/IsEnabled(COLOR_LOGIC_OP);
Multisample Fragment Ops. [17.3.3] Depth Buffer Test [17.3.6]
See BlendEquationSeparate
void LogicOp(enum op);
Enable/Disable/IsEnabled(target); Enable/Disable/IsEnabled(DEPTH_TEST); void BlendFunc(enum src, enum dst); op: CLEAR, AND, AND_REVERSE, COPY, AND_INVERTED,
target: SAMPLE_ALPHA_TO_{COVERAGE, ONE}, src, dst: See BlendFuncSeparate NOOP, XOR, OR, NOR, EQUIV, INVERT, OR_REVERSE,
SAMPLE_COVERAGE, SAMPLE_MASK void DepthFunc(enum func); COPY_INVERTED, OR_INVERTED, NAND, SET
func: See StencilFunc void BlendFuncSeparate(enum srcRGB,
void SampleCoverage(float value, enum dstRGB, enum srcAlpha,
boolean invert); Occlusion Queries [17.3.7] enum dstAlpha); Hints [21.5]
void SampleMaski(uint maskNumber, BeginQuery(enum target, uint id); srcRGB, dstRGB, srcAlpha, dstAlpha:
bitfield mask); ZERO, ONE, SRC_ALPHA_SATURATE, void Hint(enum target, enum hint);
EndQuery(enum target); {SRC, SRC1, DST, CONSTANT}_{COLOR, ALPHA}, target: FRAGMENT_SHADER_DERIVATIVE_HINT,
Stencil Test [17.3.5] target: SAMPLES_PASSED, ANY_SAMPLES_PASSED, ONE_MINUS_{SRC, SRC1}_{COLOR, ALPHA}, TEXTURE_COMPRESSION_HINT,
Enable/Disable/IsEnabled(STENCIL_TEST); ANY_SAMPLES_PASSED_CONSERVATIVE ONE_MINUS_{DST, CONSTANT}_{COLOR, ALPHA} {LINE, POLYGON}_SMOOTH_HINT
hint: FASTEST, NICEST, DONT_CARE

Whole Framebuffer Fine Control of Buffer Updates [17.4.2] void ClearBuffer{i f ui}v(enum buffer,
int drawbuffer, const T *value); attachments: COLOR_ATTACHMENTi, DEPTH, COLOR,
void ColorMask(boolean r, boolean g,
Selecting Buffers for Writing [17.4.1] boolean b, boolean a); buffer: COLOR, DEPTH, STENCIL {DEPTH, STENCIL, DEPTH_STENCIL}_ATTACHMENT,
void DrawBuffer(enum buf); {FRONT, BACK}_{LEFT, RIGHT}, STENCIL
buf: [Tables 17.4-5] NONE, void ColorMaski(uint buf, boolean r, void ClearNamedFramebuffer{i f ui}v(
{FRONT, BACK}_{LEFT, RIGHT}, FRONT, BACK, LEFT, boolean g, boolean b, boolean a); uint framebuffer, enum buffer, void InvalidateNamedFramebufferSubData(
int drawbuffer, const T *value); uint framebuffer, sizei numAttachments,
RIGHT, FRONT_AND_BACK, void DepthMask(boolean mask); buffer: See ClearBuffer{i f ui}v const enum *attachments, int x, int y,
COLOR_ATTACHMENTi (i = [0,
MAX_COLOR_ATTACHMENTS - 1 ]) void StencilMask(uint mask); sizei width, sizei height);
void ClearBufferfi(enum buffer, attachments: See InvalidateSubFramebuffer
void NamedFramebufferDrawBuffer( void StencilMaskSeparate(enum face, int drawbuffer, float depth, int stencil);
uint framebuffer, enum buf); uint mask); buffer: DEPTH_STENCIL void InvalidateFramebuffer(
face: FRONT, BACK, FRONT_AND_BACK enumtarget, sizei numAttachments,
buf: See DrawBuffer void ClearNamedFramebufferfi( const enum *attachments);
void DrawBuffers(sizei n, const enum *bufs); Clearing the Buffers [17.4.3] uint framebuffer, enum buffer, target, *attachments: See InvalidateSubFramebuffer
int drawbuffer, float depth, int stencil);
*bufs: [Tables 17.5-6] {FRONT, BACK}_{LEFT, RIGHT}, void Clear(bitfield buf);
NONE, COLOR_ATTACHMENTi (i = [0, buf: 0 or the OR of buffer: See ClearBufferi void InvalidateNamedFramebufferData(
MAX_COLOR_ATTACHMENTS - 1 ]) {COLOR, DEPTH, STENCIL}_BUFFER_BIT uint framebuffer, sizei numAttachments,
Invalidating Framebuffers [17.4.4] const enum *attachments);
void NamedFramebufferDrawBuffers( void ClearColor(float r, float g, float b, float a); void InvalidateSubFramebuffer( *attachments: See InvalidateSubFramebuffer
uint framebuffer, sizei n, void ClearDepth(double d); enum target, sizei numAttachments,
const enum *bufs); const enum *attachments, int x, int y,
void ClearDepthf(float d); sizei width, sizei height); Debug Labels [20.7]
*bufs: See DrawBuffers
void ClearStencil(int s); target: [DRAW_ , READ_]FRAMEBUFFER void ObjectLabel(enum identifier, uint name,
sizei length, const char *label);
identifier: BUFFER, FRAMEBUFFER, RENDERBUFFER,
Reading and Copying Pixels Debug Output [20] severity: DEBUG_SEVERITY_{HIGH, MEDIUM},
DEBUG_SEVERITY_{LOW, NOTIFICATION} PROGRAM_PIPELINE, PROGRAM,
Reading Pixels [18.2] Enable/Disable/IsEnabled(DEBUG_OUTPUT); QUERY, SAMPLER, SHADER, TEXTURE,
void ReadBuffer(enum src); Controlling Debug Messages [20.4] TRANSFORM_FEEDBACK, VERTEX_ARRAY
Debug Message Callback [20.2]
src: NONE, {FRONT, BACK}_{LEFT, RIGHT}, void DebugMessageControl(enum source, void ObjectPtrLabel(void* ptr, sizei length,
FRONT, BACK, LEFT, RIGHT,
void DebugMessageCallback( enum type, enum severity, sizei count,
DEBUGPROC callback, const char *label);
FRONT_AND_BACK, COLOR_ATTACHMENTi const uint *ids, boolean enabled);
const void *userParam); Synchronous Debug Output [20.8]
(i = [0, MAX_COLOR_ATTACHMENTS - 1 ]) source, type, severity: See DebuckMessageCallback
callback: has the following prototype: (above), plus DONT_CARE Enable/Disable/IsEnabled(
void NamedFramebufferReadBuffer( void callback(enum source, enum type,
uint framebuffer, enum src); DEBUG_OUTPUT_SYNCHRONOUS);
uint id, enum severity, sizei length, Externally Generated Messages [20.5]
src: See ReadBuffer const char *message, void DebugMessageInsert(enum source, Debug Output Queries [20.9]
void ReadPixels(int x, int y, sizei width, const void*userParam); enum type, uint id, enum severity, uint GetDebugMessageLog(uint count,
sizei height, enum format, enum type, source: DEBUG_SOURCE_X where X may be API, int length, const char *buf); sizei bufSize, enum *sources, enum *types,
void *data); SHADER_COMPILER, WINDOW_SYSTEM, source: DEBUG_SOURCE_{APPLICATION, THIRD_PARTY} uint *ids, enum *severities, sizei *lengths,
format: STENCIL_INDEX, RED, GREEN, BLUE, THIRD_PARTY, APPLICATION, OTHER type, severity: See DebugMessageCallback char *messageLog);
RG, RGB, RGBA, BGR, DEPTH_{COMPONENT, type: DEBUG_TYPE_X where X may be ERROR, void GetObjectLabel(enum identifier,
STENCIL}, {RED, GREEN, BLUE, RG, RGB}_ MARKER, OTHER, DEPRECATED_BEHAVIOR, Debug Groups [20.6] uint name, sizei bufSize, sizei *length,
INTEGER, {RGBA, BGR, BGRA}_INTEGER, UNDEFINED_BEHAVIOR, PERFORMANCE, void PushDebugGroup(enum source, char *label);
BGRA [Table 8.3] PORTABILITY, {PUSH, POP}_GROUP uint id, sizei length, const char *message);
source: See DebugMessageInsert void GetObjectPtrLabel(void* ptr, sizei bufSize,
type: [HALF_]FLOAT, [UNSIGNED_]BYTE, sizei *length, char *label);
[UNSIGNED_]SHORT, [UNSIGNED_]INT, mask: Bitwise 0 of the bitwise OR of void PopDebugGroup(void);
FLOAT_32_UNSIGNED_INT_24_8_REV, {COLOR, DEPTH, STENCIL}_BUFFER_BIT
UNSIGNED_{BYTE, SHORT, INT}_* filter: LINEAR, NEAREST
values in [Table 8.2]
void BlitNamedFramebuffer( State and State Requests void GetIntegeri_v(enum target, uint index,
int *data);
void ReadnPixels(int x, int y, sizei width, uint readFramebuffer, A complete list of symbolic constants for states is
sizei height, enum format, enum type, uint drawFramebuffer, int srcX0, shown in the tables in [23]. void GetFloati_v(enum target, uint index,
sizei bufSize, void *data); int srcY0, int srcX1, int srcY1, int dstX0, float *data);
Simple Queries [22.1]
format, type: See ReadPixels int dstY0, int dstX1, int dstY1,
bitfield mask, enum filter); void GetBooleanv(enum pname, boolean *data); void GetInteger64i_v(enum target, uint index,
int64 *data);
Final Conversion [18.2.8] mask, filter: See BlitFramebuffer void GetIntegerv(enum pname, int *data);
void ClampColor(enum target, enum clamp); boolean IsEnabled(enum cap);
void CopyImageSubData(uint srcName, void GetInteger64v(enum pname, int64 *data);
target: CLAMP_READ_COLOR boolean IsEnabledi(enum target, uint index);
enum srcTarget, int srcLevel, int srcX, void GetFloatv(enum pname, float *data);
clamp: TRUE, FALSE, FIXED_ONLY int srcY, int srcZ, uint dstName, String Queries [22.2]
enum dstTarget, int dstLevel, int dstX, void GetDoublev(enum pname, double *data); void GetPointerv(enum pname, void **params);
Copying Pixels [18.3] int dstY, int dstZ, sizei srcWidth, void GetDoublei_v(enum target, uint index,
sizei srcHeight, sizei srcDepth); ubyte *GetString(enum name);
void BlitFramebuffer(int srcX0, int srcY0, double *data); name: RENDERER, VENDOR, VERSION,
int srcX1, int srcY1, int dstX0, int dstY0, srcTarget, dstTarget: See target for BindTexture in
section [8.1] on this card, plus void GetBooleani_v(enum target, uint index, SHADING_LANGUAGE_VERSION
int dstX1, int dstY1, bitfield mask,
enum filter); GL_RENDERTARGET boolean *data);
(Continued on next page)

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


OpenGL 4.5 API Reference Card Page 7
States (cont.) pname:
CLEAR_{BUFFER, TEXTURE},
MAX_COMBINED_DIMENSIONS,
MAX_{WIDTH, HEIGHT, DEPTH, LAYERS},
TransformFeedback Queries [22.4]
void GetTransformFeedbackiv(uint xfb,
ubyte *GetStringi(enum name, uint index); COLOR_ENCODING, NUM_SAMPLE_COUNTS, enum pname, int *param);
name: EXTENSIONS, SHADING_LANGUAGE_VERSION COLOR_{COMPONENTS, RENDERABLE}, READ_PIXELS[_FORMAT, _TYPE], pname: TRANSFORM_FEEDBACK_{PAUSED, ACTIVE}
index: COMPUTE_TEXTURE, SAMPLES, SHADER_IMAGE_ATOMIC,
[0, NUM_EXTENSIONS - 1] (if name is EXTENSIONS); DEPTH_{COMPONENTS, RENDERABLE}, SHADER_IMAGE_{LOAD, STORE}, void GetTransformFeedbacki_v(uint xfb,
[0, NUM_SHADING_LANGUAGE_VERSIONS-1] FILTER, FRAMEBUFFER_BLEND, SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST, enum pname, uint index, int *param);
(if name is SHADING_LANGUAGE_VERSION) FRAMEBUFFER_RENDERABLE[_LAYERED], SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE, pname: TRANSFORM_FEEDBACK_BUFFER_BINDING
{FRAGMENT, GEOMETRY}_TEXTURE, SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST,
Internal Format Queries [22.3] GET_TEXTURE_IMAGE_FORMAT, SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE, void GetTransformFeedbacki64_v(uint xfb,
void GetInternalformativ(enum target, GET_TEXTURE_IMAGE_TYPE, SRGB_{READ, WRITE}, enum pname, uint index, int64 *param);
enum internalformat, enum pname, IMAGE_COMPATIBILITY_CLASS, STENCIL_{COMPONENTS, RENDERABLE}, pname: TRANSFORM_FEEDBACK_BUFFER_START,
sizei bufSize, int *params); IMAGE_PIXEL_{FORMAT, TYPE}, TESS_{CONTROL, EVALUATION}_TEXTURE, TRANSFORM_FEEDBACK_BUFFER_SIZE
target, pname, internalformat: IMAGE_FORMAT_COMPATIBILITY_TYPE, TEXTURE_COMPRESSED[_BLOCK_SIZE],
See GetInternalformati64v IMAGE_TEXEL_SIZE, TEXTURE_COMPRESSED_BLOCK_{HEIGHT, WIDTH}
INTERNALFORMAT_{PREFERRED, SUPPORTED}, TEXTURE_GATHER[_SHADOW],
void GetInternalformati64v(enum target, INTERNALFORMAT_{RED, GREEN, BLUE}_SIZE, TEXTURE_IMAGE_FORMAT,
enum internalformat, enum pname, INTERNALFORMAT_{DEPTH, STENCIL}_SIZE, TEXTURE_IMAGE_TYPE,
sizei bufSize, int64 *params); INTERNALFORMAT_{ALPHA, SHARED}_SIZE, TEXTURE_{SHADOW, VIEW},
target: [Table 22.2] INTERNALFORMAT_{RED, GREEN}_TYPE, VERTEX_TEXTURE,
TEXTURE_{1D, 2D, 3D, CUBE_MAP}[_ARRAY], INTERNALFORMAT_{BLUE, ALPHA}_TYPE, VIEW_COMPATIBILITY_CLASS
TEXTURE_2D_MULTISAMPLE[_ARRAY], INTERNALFORMAT_{DEPTH, STENCIL}_TYPE,
TEXTURE_{BUFFER, RECTANGLE}, RENDERBUFFER [MANUAL_GENERATE_]MIPMAP,
internalformat: any value

OpenGL Compute Programming Model and Compute Memory Hierarchy

gl_NumWorkGroups = (4,2,0)
Use the barrier function to synchronize invocations in a work group:
void barrier();
Use the memoryBarrier* or groupMemoryBarrier functions to order
reads/writes accessible to other invocations:
void memoryBarrier();
void memoryBarrierAtomicCounter();
void memoryBarrierBuffer();
void memoryBarrierImage();
void memoryBarrierShared(); // Only for compute shaders gl_WorkGroupSize = (4,2,0)
void groupMemoryBarrier(); // Only for compute shaders gl_WorkGroupID = (2,0,0)
gl_LocalInvocationID = (1,0,0)
Use the compute shader built-in variables to specifiy work groups and invocations:
gl_GlobalInvocationID = (9,3,0)
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)

OpenGL Texture Views and Texture Object State

Texture state set with TextureView()


enum internalformat // base internal format uint minlevel // first level of mipmap uint minlayer // first layer of array texture
enum target // texture target uint numlevels // number of mipmap levels uint numlayers // number of layers in array

Sampler Parameters (mutable) Texture Parameters (immutable) Texture View Parameters (immutable)
TEXTURE_BORDER_COLOR TEXTURE_WIDTH TEXTURE_HEIGHT <target>
TEXTURE_COMPARE_{FUNC,MODE} TEXTURE_DEPTH TEXTURE_FIXED_SAMPLE_LOCATIONS TEXTURE_INTERNAL_FORMAT TEXTURE_SHARED_SIZE
TEXTURE_LOD_BIAS TEXTURE_COMPRESSED TEXTURE_COMPRESSED_IMAGE_SIZE TEXTURE_VIEW_{MIN,NUM}_LEVEL TEXTURE_VIEW_{MIN,NUM}_LAYER
TEXTURE_{MAX,MIN}_LOD TEXTURE_IMMUTABLE_FORMAT TEXTURE_SAMPLES TEXTURE_IMMUTABLE_LEVELS IMAGE_FORMAT_COMPATIBILITY_TYPE
TEXTURE_{MAG,MIN}_FILTER Texture Parameters (mutable) TEXTURE_{RED,GREEN,BLUE,ALPHA,DEPTH}_TYPE
TEXTURE_WRAP_{S,T,R} TEXTURE_SWIZZLE_{R,G,B,A} TEXTURE_MAX_LEVEL TEXTURE_{RED,GREEN,BLUE,ALPHA,DEPTH,STENCIL}_SIZE
TEXTURE_BASE_LEVEL DEPTH_STENCIL_TEXTURE_MODE

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


Page 8 OpenGL 4.5 API Reference Card
OpenGL Pipeline
A typical program that uses OpenGL
begins with calls to open a window into
the framebuffer 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 illustration
show the OpenGL pipeline and indicate
data flow.

Blue blocks indicate various buffers


that feed or get fed by the OpenGL
pipeline.
Green blocks indicate fixed function
stages.
Yellow blocks indicate programmable
stages.
T Texture binding
B Buffer binding

Vertex & Tessellation Details


Each vertex is processed either by a vertex shader
or fixed-function vertex processing (compatibility
only) to generate a transformed vertex, then
assembled into primitives. Tessellation (if enabled)
operates on patch primitives, consisting of a fixed-
size collection of vertices, each with per-vertex
attributes and associated per-patch attributes.
Tessellation control shaders (if enabled) transform
an input patch and compute per-vertex and per-
patch attributes for a new output patch.
A fixed-function primitive generator
subdivides the patch according to
tessellation levels computed in the
tessellation control shaders or specified
as fixed values in the API (TCS disabled).
The tessellation evaluation shader
computes the position and attributes of
each vertex produced by the tessellator.
Orange blocks indicate features of the Core
specification.
Purple blocks indicate features of the
Compatibility specification.
Green blocks indicate features new or
significantly changed with OpenGL 4.x.

Geometry & Follow-on Details


Geometry shaders (if enabled) consume
individual primitives built in previous primitive
assembly stages. For each input primitive,
the geometry shader can output zero or more
vertices, with each vertex directed at a specific
vertex stream. The vertices emitted to each
stream are assembled into primitives according
to the geometry shader’s output primitive type.
Transform feedback (if active) writes selected
vertex attributes of the primitives of all vertex
streams into buffer objects attached to one or
more binding points.
Primitives on vertex stream zero are then
processed by fixed-function stages, where they
are clipped and prepared for rasterization.
Orange blocks indicate features of the Core
specification.
Purple blocks indicate features of the
Compatibility specification.
Green blocks indicate features new or
significantly changed with OpenGL 4.x.

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


OpenGL Shading Language 4.50 Reference Card Page 9
The OpenGL® Shading Language is used to create Preprocessor [3.3] Predefined Macros
shaders for each of the programmable processors Preprocessor Operators Decimal integer constants. __FILE__ says
__LINE__ __FILE__
which source string is being processed.
contained in the OpenGL processing pipeline. The #version 450 Required when using version 4.50.
OpenGL Shading Language is actually several closely #version 450 profile profile is core, compatibility, or es (for __VERSION__ Decimal integer, e.g.: 450
ES versions 1.00, 3.00, or 3.10).
related languages. Currently, these processors are the GL_core_profile Defined as 1
#extension • behavior: require, enable, warn,
vertex, tessellation control, tessellation evaluation, extension_name : disable GL_es_profile 1 if the ES profile is supported
geometry, fragment, and compute shaders. behavior • extension_name: extension Defined as 1 if the implementation
GL_compatibility_profile
#extension all : behavior supported by compiler, or “all” supports the compatibility profile.
[n.n.n] and [Table n.n] refer to sections and tables in
the OpenGL Shading Language 4.50 specification at Preprocessor Directives
www.opengl.org/registry # #define #elif #else #endif #error #extension
#if #ifdef #ifndef #line #pragma #undef #version

Operators and Expressions [5.1] 3.


++ -- prefix increment and decrement 11. | bit-wise inclusive or Vector & Scalar Components [5.5]
The following operators are numbered in order +-~! unary 12. && logical and In addition to array numeric subscript syntax,
of precedence. Relational and equality operators 4. */% multiplicative 13. ^^ logical exclusive or names of vector and scalar components are
evaluate to Boolean. Also See lessThan(), equal(). denoted by a single letter. Components can be
5. +- additive 14. || logical inclusive or
1. () parenthetical grouping 6. << >> bit-wise shift 15. ?: selects an entire operand swizzled and replicated. Scalars have only an x, r,
= += -= or s component.
7. < > <= >= relational
[] array subscript *= /= assignment {x, y, z, w} Points or normals
() function call, constructor, structure 8. == != equality 16.
2. %= <<= >>= arithmetic assignments {r, g, b, a} Colors
. field, selector, swizzle 9. & bit-wise and &= ^= |=
++ -- postfix increment and decrement 10. ^ bit-wise exclusive or 17. , sequence {s, t, p, q} Texture coordinates

Types [4.1] Floating-Point Opaque Types Signed Integer Opaque Types (cont’d) Unsigned Integer Opaque Types (cont’d)
sampler{1D,2D,3D} 1D, 2D, or 3D texture iimage2DRect
int. 2D rectangular image uimage2DMSArray uint 2D multi-sample array image
Transparent Types image{1D,2D,3D}
void no function return value isampler[1,2]DArray
integer 1D, 2D array texture usamplerCubeArray uint cube map array texture
samplerCube cube mapped texture iimage[1,2]DArray
integer 1D, 2D array image
bool Boolean imageCube uimageCubeArray uint cube map array image
isamplerBuffer
integer buffer texture
int, uint signed/unsigned integers sampler2DRect rectangular texture Implicit Conversions
image2DRect iimageBuffer
integer buffer image int -> uint uvec2 -> dvec2
float single-precision floating-point
scalar sampler{1D,2D}Array 1D or 2D array texture isampler2DMS
int. 2D multi-sample texture int, uint -> float uvec3 -> dvec3
double double-precision floating scalar image{1D,2D}Array iimage2DMS
int. 2D multi-sample image int, uint, float -> double uvec4 -> dvec4
vec2, vec3, vec4 floating point vector samplerBuffer buffer texture ivec2 -> uvec2 vec2 -> dvec2
imageBuffer isampler2DMSArray
int. 2D multi-sample array tex.
dvec2, dvec3, dvec4 double precision floating-point ivec3 -> uvec3 vec3 -> dvec3
vectors sampler2DMS 2D multi-sample texture iimage2DMSArray
int. 2D multi-sample array image ivec4 -> uvec4 vec4 -> dvec4
bvec2, bvec3, bvec4 Boolean vectors image2DMS isamplerCubeArray
int. cube map array texture ivec2 -> vec2 mat2 -> dmat2
sampler2DMSArray 2D multi-sample array iimageCubeArray
int. cube map array image ivec3 -> vec3 mat3 -> dmat3
ivec2, ivec3, ivec4 signed and unsigned integer ivec4 -> vec4 mat4 -> dmat4
uvec2, uvec3, uvec4 vectors image2DMSArray texture
samplerCubeArray cube map array texture Unsigned Integer Opaque Types uvec2 -> vec2 mat2x3 -> dmat2x3
mat2, mat3, mat4 2x2, 3x3, 4x4 float matrix uvec3 -> vec3 mat2x4 -> dmat2x4
mat2x2, mat2x3, 2-column float matrix of imageCubeArray
atomic_uint uint atomic counter uvec4 -> vec4 mat3x2 -> dmat3x2
mat2x4 2, 3, or 4 rows sampler1DShadow 1D or 2D depth texture ivec2 -> dvec2 mat3x4 -> dmat3x4
sampler2DShadow with comparison usampler[1,2,3]D uint 1D, 2D, or 3D texture
mat3x2, mat3x3, 3-column float matrix of
mat3x4 2, 3, or 4 rows sampler2DRectShadow rectangular tex. / compare uimage[1,2,3]D uint 1D, 2D, or 3D image ivec3 -> dvec3 mat4x2 -> dmat4x2
mat4x2, mat4x3, 4-column float matrix of sampler1DArrayShadow 1D or 2D array depth usamplerCube uint cube mapped texture ivec4 -> dvec4 mat4x3 -> dmat4x4
mat4x4 2, 3, or 4 rows sampler2DArrayShadow texture with comparison uimageCube uint cube mapped image
dmat2, dmat3, 2x2, 3x3, 4x4 double-precision samplerCubeShadow cube map depth texture usampler2DRect
Aggregation of Basic Types
uint rectangular texture Arrays float[3] foo; float foo[3]; int a [3][2];
dmat4 float matrix with comparison
dmat2x2, dmat2x3, 2-col. double-precision float uimage2DRect uint rectangular image // Structures, blocks, and structure members
samplerCubeArrayShadow cube map array depth usampler[1,2]DArray 1D or 2D array texture // can be arrays. Arrays of arrays supported.
dmat2x4 matrix of 2, 3, 4 rows texture with comparison
dmat3x2, dmat3x3, 3-col. double-precision float uimage[1,2]DArray 1D or 2D array image Structures struct type-name {
dmat3x4 matrix of 2, 3, 4 rows Signed Integer Opaque Types usamplerBuffer uint buffer texture members
dmat4x2, dmat4x3, 4-column double-precision float } struct-name[];
isampler[1,2,3]D integer 1D, 2D, or 3D texture uimageBuffer uint buffer image // optional variable declaration
dmat4x4 matrix of 2, 3, 4 rows
iimage[1,2,3]D integer 1D, 2D, or 3D image usampler2DMS uint 2D multi-sample texture Blocks in/out/uniform block-name {
isamplerCube integer cube mapped texture // interface matching by block name
uimage2DMS uint 2D multi-sample image
iimageCube integer cube mapped image optionally-qualified members
Qualifiers isampler2DRect int. 2D rectangular texture
usampler2DMSArray uint 2D multi-sample array tex. } instance-name[];
Storage Qualifiers [4.3] Continue  Continue  // optional instance name, optionally an array
Declarations may have one storage qualifier.
(default) local read/write memory, Layout Qualifiers [4.4]
none
or input parameter The following table summarizes the use of layout qualifiers applied to non-opaque types and the kinds of declarations they may be applied to.
const read-only variable Op = Opaque types only, FC = gl_FragCoord only, FD = gl_FragDepth only.
in linkage into shader from previous stage Layout Qualifier Qualif. Indiv. Block Layout Qualifier Qualif. Indiv. Block
Only Var. Block Mem. Allowed Interfaces
Only Var. Block Mem. Allowed Interfaces
out linkage out of a shader to next stage shared, packed, std{140, 430} X X origin_upper_left
FC
linkage between a shader, OpenGL, {row, column}_major X X X pixel_center_integer fragment in
uniform early_fragment_tests X
and the application binding = Op X uniform/buffer
offset = X local_size_{x, y, z} = X compute in
buffer accessible by shaders and OpenGL API
align = X X xfb_{buffer, stride} = X X X X vertex, tessellation, and
compute shader only, shared among work xfb_offset = X X X geometry out
shared uniform/buffer and
items in a local work group location = X vertices = X tessellation control out
subroutine variables
Auxiliary Storage Qualifiers location = X X X all in/out, except for [ points ], line_strip,
X
Use to qualify some input and output variables: component = X X compute triangle_strip
geometry out
max_vertices = X
centroid centroid-based interpolation fragment out and stream = X X X X
index = X
subroutine functions depth_{any, greater,
sampler per-sample interpolation FD fragment out
triangles, quads, isolines X less, unchanged}
patch per-tessellation-patch attributes equal_spacing,
fractional_even_spacing, X tessellation evaluation Opaque Uniform Layout Qualifiers [4.4.6]
Interface Blocks [4.3.9] fractional_odd_spacing in Used to bind opaque uniform variables to specific buffers or units.
in, out, uniform, and buffer variable cw, ccw X binding = integer-constant-expression
declarations can be grouped. For example: point_mode X
uniform Transform { points X geometry in/out Atomic Counter Layout Qualifiers
// allowed restatement qualifier: [ points ], lines, triangles, binding = integer-constant-expression
mat4 ModelViewMatrix; X geometry in offset = integer-constant-expression
{triangles, lines}_adjacency
uniform mat3 NormalMatrix; invocations = X geometry in
}; (Continued on next page)

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


Page 10 OpenGL Shading Language 4.50 Reference Card
Qualifiers (continued) Invariant Qualifiers Examples [4.8] Operations and Constructors Examples of operations on matrices and vectors:
m = f * m; // scalar * matrix component-wise
These are for vertex, tessellation, geometry,
Format Layout Qualifiers and fragment languages. Vector & Matrix [5.4.2] v = f * v; // scalar * vector component-wise
One qualifier may be used with variables #pragma STDGL force all output variables .length() for matrices returns number of columns v = v * v; // vector * vector component-wise
declared as “image” to specify the image format. invariant(all) to be invariant .length() for vectors returns number of components m = m +/- m; // matrix +/- matrix comp.-wise
mat2(vec2, vec2); // 1 col./arg. m = m * m; // linear algebraic multiply
binding = integer-constant-expression, invariant gl_Position; qualify a previously f = dot(v, v); // vector dot product
rgba{32,16}f, rg{32,16}f, r{32,16}f, mat2x3(vec2, float, vec2, float); // col. 2 v = cross(v, v); // vector cross product
declared variable
rgba{16,8}, r11f_g11f_b10f, rgb10_a2{ui}, dmat2(dvec2, dvec2); // 1 col./arg.
rg{16,8}, r{16,8}, rgba{32,16,8}i, rg{32,16,8} invariant centroid out qualify as part of a dmat3(dvec3, dvec3, dvec3); // 1 col./arg. Array Example [5.4.4]
vec3 Color; variable declaration const float c[3];
i, r{32,16,8}i, rgba{32,16,8}ui, rg{32,16,8}ui, Structure Example [5.4.3] c.length() // will return the integer 3
r{32,16,8}ui, rgba{16,8}_snorm, .length() for structures returns number of members
rg{16,8}_snorm, r{16,8}_snorm Precise Qualifier [4.9] struct light {members; }; Structure & Array Operations [5.7]
Ensures that operations are executed in stated Select structure fields or length() method of an
Interpolation Qualifiers [4.5] order with operator consistency. For example, light lightVar = light(3.0, vec3(1.0, 2.0, 3.0));
array using the period (.) operator. Other operators:
Qualify outputs from vertex shader and inputs a fused multiply-add cannot be used in the
to fragment shader. Matrix Examples [5.6] . field or method selector
following; it requires two identical multiplies, Examples of access components of a matrix with
followed by an add. == != equality
smooth perspective correct interpolation array subscripting syntax:
precise out vec4 Position = a * b + c * d; mat4 m; // m is a matrix = assignment
flat no interpolation [] indexing (arrays only)
Memory Qualifiers [4.10] m[1] = vec4(2.0); // sets 2nd col. to all 2.0
noperspective linear interpolation
Variables qualified as “image” can have one or m[0][0] = 1.0; // sets upper left element to 1.0 Array elements are accessed using the array
Parameter Qualifiers [4.6] more memory qualifiers. m[2][3] = 2.0; // sets 4th element of 3rd col. to 2.0 subscript operator ( [ ] ), e.g.:
Input values copied in at function call time, coherent reads and writes are coherent with diffuseColor += lightIntensity[3]*NdotL;
output values copied out at function return. other shader invocations
volatile underlying values may be changed by
none (default) same as in other sources
in for function parameters passed into restrict won’t be accessed by other code
Statements and Structure Declare subroutine type variables with a specific
subroutine type in a subroutine uniform variable
function readonly read only
Subroutines [6.1.2] declaration:
const for function parameters that cannot be Subroutine type variables are assigned to functions
writeonly write only through the UniformSubroutinesuiv command in the subroutine uniform subroutineTypeName
written to subroutineVarName;
out for function parameters passed back out of OpenGL API.
Order of Qualification [4.11]
function, but not initialized when passed in When multiple qualifiers are present in a Declare types with the subroutine keyword: Iteration and Jumps [6.3-4]
inout for function parameters passed both into declaration they may appear in any order, but subroutine returnType subroutineTypeName(type0 Function call by value-return
and out of a function must all appear before the type. arg0, Iteration for (;;) { break, continue }
The layout qualifier is the only qualifier that can type1 arg1, ..., typen argn); while ( ) { break, continue }
Precision Qualifiers [4.7] appear more than once. Further, a declaration do { break, continue } while ( );
Qualify individual variables: can have at most one storage qualifier, at most Associate functions with subroutine types of Selection if ( ) { }
{highp, mediump, lowp} variable-declaration; one auxiliary storage qualifier, and at most one matching declarations by defining the functions if ( ) { } else { }
interpolation qualifier. with the subroutine keyword and a list of switch ( ) { case integer: … break; …
Establish a default precision qualifier: default: … }
Multiple memory qualifiers can be used. Any subroutine types the function matches:
precision {highp, mediump, lowp} {int, float}; Entry void main()
rule violation will cause a compile-time error. subroutine(subroutineTypeName0, ...,
subroutineTypeNameN)
Jump break, continue, return
(There is no ‘goto’)
returnType functionName(type0 arg0,
Built-In Variables [7] Geometry Language type1 arg1, ..., typen argn){ ... } Exit return in main()
discard // Fragment shader only
Vertex Language in gl_PerVertex { // function body
vec4 gl_Position;
in int gl_VertexID;
Inputs

float gl_PointSize;
in int gl_InstanceID; float gl_ClipDistance[]; Built-In Constants [7.3] const int gl_MaxTessControlOutputComponents = 128;
Inputs

out gl_PerVertex { float gl_CullDistance[]; The following are provided to all shaders. The const int gl_MaxTessControlTextureImageUnits = 16;
vec4 gl_Position; } gl_in[]; actual values are implementation-dependent, but const int gl_MaxTessControlUniformComponents = 1024;
Outputs

float gl_PointSize; in int gl_PrimitiveIDIn; must be at least the value shown. const int gl_MaxTessControlTotalOutputComponents = 4096;
float gl_ClipDistance[]; in int gl_InvocationID; const ivec3 gl_MaxComputeWorkGroupCount = const int gl_MaxTessEvaluationInputComponents = 128;
float gl_CullDistance[]; {65535, 65535, 65535} ;
out gl_PerVertex { const int gl_MaxTessEvaluationOutputComponents = 128;
}; vec4 gl_Position; const ivec3 gl_MaxComputeWorkGroupSize[] = const int gl_MaxTessEvaluationTextureImageUnits = 16;
Tessellation Control Language float gl_PointSize; {1024, 1024, 64}; const int gl_MaxTessEvaluationUniformComponents = 1024;
float gl_ClipDistance[]; const int gl_MaxComputeUniformComponents = 1024; const int gl_MaxTessPatchComponents = 120;
Outputs

in gl_PerVertex { float gl_CullDistance[];


vec4 gl_Position; const int gl_MaxComputeTextureImageUnits = 16; const int gl_MaxPatchVertices = 32;
};
float gl_PointSize; const int gl_MaxComputeImageUniforms = 8; const int gl_MaxTessGenLevel = 64;
float gl_ClipDistance[]; out int gl_PrimitiveID; const int gl_MaxComputeAtomicCounters = 8;
out int gl_Layer; const int gl_MaxViewports = 16;
float gl_CullDistance[];
Inputs

const int gl_MaxComputeAtomicCounterBuffers = 1; const int gl_MaxVertexUniformVectors = 256;


} gl_in[gl_MaxPatchVertices]; out int gl_ViewportIndex;
const int gl_MaxVertexAttribs = 16; const int gl_MaxFragmentUniformVectors = 256;
in int gl_PatchVerticesIn; Fragment Language const int gl_MaxVertexUniformComponents = 1024; const int gl_MaxVaryingVectors = 15;
in int gl_PrimitiveID; in vec4 gl_FragCoord; const int gl_MaxVaryingComponents= 60; const int gl_MaxVertexAtomicCounters = 0;
in int gl_InvocationID; in bool gl_FrontFacing; const int gl_MaxVertexOutputComponents = 64; const int gl_MaxTessControlAtomicCounters = 0;
out gl_PerVertex { in float gl_ClipDistance[]; const int gl_MaxGeometryInputComponents = 64; const int gl_MaxTessEvaluationAtomicCounters = 0;
vec4 gl_Position; in float gl_CullDistance[]; const int gl_MaxGeometryOutputComponents = 128;
float gl_PointSize;
const int gl_MaxGeometryAtomicCounters = 0;
in vec2 gl_PointCoord; const int gl_MaxFragmentInputComponents = 128;
float gl_ClipDistance[]; const int gl_MaxFragmentAtomicCounters = 8;
Outputs

in int gl_PrimitiveID;
Inputs

float gl_CullDistance[]; const int gl_MaxVertexTextureImageUnits = 16; const int gl_MaxCombinedAtomicCounters = 8;


in int gl_SampleID;
} gl_out[]; in vec2 gl_SamplePosition; const int gl_MaxCombinedTextureImageUnits = 80; const int gl_MaxAtomicCounterBindings = 1;
in int gl_SampleMaskIn[]; const int gl_MaxTextureImageUnits = 16; const int gl_MaxVertexAtomicCounterBuffers = 0;
patch out float gl_TessLevelOuter[4];
patch out float gl_TessLevelInner[2]; in int gl_Layer; const int gl_MaxImageUnits = 8; const int gl_MaxTessControlAtomicCounterBuffers = 0;
in int gl_ViewportIndex; gl_MaxCombinedImageUnitsAndFragmentOutputs = 8; const int gl_MaxTessEvaluationAtomicCounterBuffers = 0;
Tessellation Evaluation Language in bool gl_HelperInvocation; const int gl_MaxImageSamples = 0; const int gl_MaxGeometryAtomicCounterBuffers = 0;
in gl_PerVertex { const int gl_MaxVertexImageUniforms= 0; const int gl_MaxFragmentAtomicCounterBuffers = 1;
Outputs

out float gl_FragDepth;


vec4 gl_Position; out int gl_SampleMask[]; const int gl_MaxTessControlImageUniforms = 0; const int gl_MaxCombinedAtomicCounterBuffers = 1;
float gl_PointSize; const int gl_MaxTessEvaluationImageUniforms = 0;
float gl_ClipDistance[]; const int gl_MaxAtomicCounterBufferSize = 32;
Compute Language const int gl_MaxGeometryImageUniforms = 0; const int gl_MinProgramTexelOffset = -8;
float gl_CullDistance[];
const int gl_MaxFragmentImageUniforms = 8;
Inputs

} gl_in[gl_MaxPatchVertices]; More information in diagram on page 6. const int gl_MaxProgramTexelOffset = 7;


Work group dimensions const int gl_MaxCombinedImageUniforms = 8; const int gl_MaxTransformFeedbackBuffers = 4;
in int gl_PatchVerticesIn; const int gl_MaxFragmentUniformComponents = 1024;
in int gl_PrimitiveID; in uvec3 gl_NumWorkGroups; gl_MaxTransformFeedbackInterleavedComponents = 64;
in vec3 gl_TessCoord; const uvec3 gl_WorkGroupSize; const int gl_MaxDrawBuffers = 8; const int gl_MaxCullDistances = 8;
patch in float gl_TessLevelOuter[4]; in uvec3 gl_LocalGroupSize; const int gl_MaxClipDistances = 8; const int gl_MaxCombinedClipAndCullDistances = 8;
patch in float gl_TessLevelInner[2]; Work group and invocation IDs const int gl_MaxGeometryTextureImageUnits = 16; const int gl_MaxSamples = 4;
Inputs

out gl_PerVertex { in uvec3 gl_WorkGroupID; const int gl_MaxGeometryOutputVertices = 256; const int gl_MaxVertexImageUniforms = 0;
vec4 gl_Position; in uvec3 gl_LocalInvocationID; const int gl_MaxGeometryTotalOutputComponents = 1024; const int gl_MaxFragmentImageUniforms = 8;
Outputs

float gl_PointSize; const int gl_MaxGeometryUniformComponents = 1024;


Derived variables const int gl_MaxComputeImageUniforms = 8;
float gl_ClipDistance[];
float gl_CullDistance[]; in uvec3 gl_GlobalInvocationID; const int gl_MaxGeometryVaryingComponents = 64; const int gl_MaxCombinedImageUniforms = 48;
}; in uint gl_LocalInvocationIndex; const int gl_MaxTessControlInputComponents = 128; const int gl_MaxCombinedShaderOutputResources = 16;

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


OpenGL Shading Language 4.50 Reference Card Page 11
Built-In Functions Common Functions (cont.) Type Abbreviations for Built-in Functions: In vector types, n is 2, 3, or 4.
Angle & Trig. Functions [8.1] Returns maximum value:
Functions will not result in a divide-by-zero Tf=float, vecn. Td =double, dvecn. Tfd= float, vecn, double, dvecn. Tb= bool, bvecn.
Tu=uint, uvecn. Ti=int, ivecn. Tiu=int, ivecn, uint, uvecn. Tvec=vecn, uvecn, ivecn.
error. If the divisor of a ratio is 0, then results Tfd max(Tfd x, Tfd y) Tiu max(Tiu x, Tiu y)
will be undefined. Component-wise operation. Within any one function, type sizes and dimensionality must correspond after implicit type
Tf max(Tf x, float y) Ti max(Ti x, int y) conversions. For example, float round(float) is supported, but float round(vec4) is not.
Parameters specified as angle are in units of
radians. Tf=float, vecn. Td max(Td x, double y) Tu max(Tu x, uint y)
Returns min(max(x, minVal), maxVal): Geometric Functions [8.5] Integer Functions (cont.)
Tf radians(Tf degrees) degrees to radians
Tfd clamp(Tfd x, Tfd minVal, Tfd maxVal) These functions operate on vectors as vectors, not
Tf degrees(Tf radians) radians to degrees Tf clamp(Tf x, float minVal, float maxVal) component-wise. Tf=float, vecn. Td =double, dvecn. Multiplies 32-bit integers x and y, producing a 64-bit result:
Tf sin(Tf angle) sine Tfd= float, vecn, double, dvecn. void umulExtended(Tu x, Tu y, out Tu msb, out Tu lsb)
Td clamp(Td x, double minVal, double maxVal)
Tiu clamp(Tiu x, Tiu minVal, Tiu maxVal) float length(Tf x) void imulExtended(Ti x, Ti y, out Ti msb, out Ti lsb)
Tf cos(Tf angle) cosine length of vector
Ti clamp(Ti x, int minVal, int maxVal) double length(Td x)
Tf tan(Tf angle) tangent Extracts bits [offset, offset + bits - 1] from value, returns
Tu clamp(Tu x, uint minVal, uint maxVal) float distance(Tf p0, Tf p1) them in the least significant bits of the result:
Tf asin(Tf x) arc sine distance between points
Returns linear blend of x and y: double distance(Td p0, Td p1) Tiu bitfieldExtract(Tiu value, int offset, int bits)
Tf acos(Tf x) arc cosine float dot(Tf x, Tf y) Returns the reversal of the bits of value:
Tfd mix(Tfd x, Tfd y, Tfd a) Ti mix(Ti x, Ti y, Ti a) dot product
Tf atan(Tf y, Tf x) double dot(Td x, Td y) Tiu bitfieldReverse(Tiu value)
arc tangent Tf mix(Tf x, Tf y, float a) Tu mix(Tu x, Tu y, Tu a)
Tf atan(Tf y_over_x) Inserts the bits least-significant bits of insert into base:
Td mix(Td x, Td y, double a) vec3 cross(vec3 x, vec3 y)
Tf sinh(Tf x) hyperbolic sine cross product Tiu bitfieldInsert(Tiu base, Tiu insert, int offset, int bits)
Components returned come from x when a components dvec3 cross(dvec3 x, dvec3 y)
Tf cosh(Tf x) hyperbolic cosine are true, from y when a components are false: Tfd normalize(Tfd x) normalize vector to length 1 Returns the number of bits set to 1:
Tfd mix(Tfd x, Tfd y, Tb a) Tb mix(Tb x, Tb y, Tb a) Tfd faceforward(Tfd N, Ti bitCount(Tiu value)
Tf tanh(Tf x) hyperbolic tangent returns N if dot(Nref, I) <
Tiu mix(Tiu x, Tiu y, Tb a) Tfd I, Tfd Nref) 0, else -N Returns the bit number of the least significant bit:
Tf asinh(Tf x) hyperbolic sine
Returns 0.0 if x < edge, else 1.0: Tfd reflect(Tfd I, Tfd N) reflection direction Ti findLSB(Tiu value)
Tf acosh(Tf x) hyperbolic cosine I - 2 * dot(N,I) * N
Tfd step(Tfd edge, Tfd x) Returns the bit number of the most significant bit:
Tf atanh(Tf x) hyperbolic tangent Td step(double edge, Td x) Tfd refract(Tfd I, Tfd N, Ti findMSB(Tiu value)
Tf step(float edge, Tf x) refraction vector
float eta)
Clamps and smoothes:
Exponential Functions [8.2] Tfd smoothstep(Tfd edge0, Tfd edge1, Tfd x) Texture Lookup Functions [8.9]
Component-wise operation. Tf=float, vecn. Available to vertex, geometry, and fragment
Tf smoothstep(float edge0, float edge1, Tf x) Matrix Functions [8.6] shaders. See tables on next page.
Td= double, dvecn. Tfd= Tf, Td N and M are 1, 2, 3, 4.
Td smoothstep(double edge0, double edge1, Td x)
Tf pow(Tf x, Tf y) xy mat matrixCompMult(mat x, mat y) component-wise Atomic-Counter Functions [8.10]
Returns true if x is NaN:
dmat matrixCompMult(dmat x, dmat y) multiply Returns the value of an atomic counter.
Tf exp(Tf x) ex Tb isnan(Tfd x)
matN outerProduct(vecN c, vecN r) outer product Atomically increments c then returns its prior value:
Tf log(Tf x) ln Returns true if x is positive or negative infinity:
dmatN outerProduct(dvecN c, dvecN r) (where N != M) uint atomicCounterIncrement(atomic_uint c)
Tb isinf(Tfd x)
Tf exp2(Tf x) 2x matNxM outerProduct(vecM c, vecN r) Atomically decrements c then returns its prior value:
Returns signed int or uint value of the encoding of a float: outer product
dmatNxM outerProduct(dvecM c, dvecN r) uint atomicCounterDecrement(atomic_uint c)
Tf log2(Tf x) log2 Ti floatBitsToInt(Tf value)
Tu floatBitsToUint(Tf value) matN transpose(matN m) Atomically returns the counter for c:
Tfd sqrt(Tfd x) square root transpose
dmatN transpose(dmatN m) uint atomicCounter(atomic_uint c)
Returns float value of a signed int or uint encoding of a float:
Tfd inversesqrt(Tfd x) inverse square root matNxM transpose(matMxN m) transpose
Tf intBitsToFloat(Ti value) Tf uintBitsToFloat(Tu value) dmatNxM transpose(dmatMxN m) (where N != M) Atomic Memory Functions [8.11]
Operates on individual integers in buffer-object
Common Functions [8.3] Computes and returns a*b + c. Treated as a single operation float determinant(matN m) or shared-variable storage. OP is Add, Min, Max,
determinant
Component-wise operation. Tf=float, vecn. Tb=bool, when using precise: double determinant(dmatN m) And, Or, Xor, Exchange, or CompSwap.
bvecn. Ti=int, ivecn. Tu=uint, uvecn. Tfd fma(Tfd a, Tfd b, Tfd c) matN inverse(matN m)
Td= double, dvecn. Tfd= Tf, Td. Tiu= Ti, Tu. inverse uint atomicOP(coherent inout uint mem, uint data)
dmatN inverse(dmatN m)
Splits x into a floating-point significand in the range [0.5, 1.0)
Returns absolute value: and an integer exponent of 2: int atomicOP(coherent inout int mem, int data)
Tfd abs(Tfd x) Ti abs(Ti x) Tfd frexp(Tfd x, out Ti exp) Vector Relational Functions [8.7]
Compare x and y component-wise. Sizes of the Image Functions [8.12]
Returns -1.0, 0.0, or 1.0: Builds a floating-point number from x and the corresponding In the image functions below, IMAGE_PARAMS
input and return vectors for any particular call
Tfd sign(Tfd x) Ti sign(Ti x) integral exponent of 2 in exp: must match. Tvec=vecn, uvecn, ivecn. may be one of the following:
gimage1D image, int P
Returns nearest integer <= x: Tfd ldexp(Tfd x, in Ti exp)
bvecn lessThan(Tvec x, Tvec y) < gimage2D image, ivec2 P
Tfd floor(Tfd x) gimage3D image, ivec3 P
bvecn lessThanEqual(Tvec x, Tvec y) <= gimage2DRect image, ivec2 P
Returns nearest integer with absolute value <= absolute Floating-Point Pack/Unpack [8.4]
value of x: These do not operate component-wise. gimageCube image, ivec3 P
bvecn greaterThan(Tvec x, Tvec y) >
gimageBuffer image, int P
Tfd trunc(Tfd x) Converts each component of v into 8- or 16-bit ints, packs bvecn greaterThanEqual(Tvec x, Tvec y) >= gimage1DArray image, ivec2 P
Returns nearest integer, implementation-dependent results into the returned 32-bit unsigned integer: gimage2DArray image, ivec3 P
rounding mode: bvecn equal(Tvec x, Tvec y) gimageCubeArray image, ivec3 P
uint packUnorm2x16(vec2 v) uint packUnorm4x8(vec4 v) ==
Tfd round(Tfd x) bvecn equal(bvecn x, bvecn y) gimage2DMS image, ivec2 P, int sample
uint packSnorm2x16(vec2 v) uint packSnorm4x8(vec4 v) gimage2DMSArray image, ivec3 P, int sample
Returns nearest integer, 0.5 rounds to nearest even integer:
Unpacks 32-bit p into two 16-bit uints, four 8-bit uints, or bvecn notEqual(Tvec x, Tvec y)
Tfd roundEven(Tfd x) != Returns the dimensions of the images or images:
signed ints. Then converts each component to a normalized bvecn notEqual(bvecn x, bvecn y)
Returns nearest integer >= x: float to generate a 2- or 4-component vector: int imageSize(gimage{1D,Buffer} image)
Tfd ceil(Tfd x) vec2 unpackUnorm2x16(uint p) bool any(bvecn x) true if any component of x is true ivec2 imageSize(gimage{2D,Cube,Rect,1DArray,
vec2 unpackSnorm2x16(uint p) 2DMS} image)
Returns x - floor(x): bool all(bvecn x) true if all comps. of x are true
vec4 unpackUnorm4x8(uint p) ivec3 imageSize(gimage{Cube,2D,2DMS}Array image)
Tfd fract(Tfd x) vec4 unpackSnorm4x8(uint p) bvecn not(bvecn x) logical complement of x vec3 imageSize(gimage3D image)
Returns modulus: Packs components of v into a 64-bit value and returns a Returns the number of samples of the image or images
Tfd mod(Tfd x, Tfd y) double-precision value: bound to image:
Td mod(Td x, double y) Integer Functions [8.8]
Tf mod(Tf x, float y) double packDouble2x32(uvec2 v) int imageSamples(gimage2DMS image)
Component-wise operation. Tu=uint, uvecn. int imageSamples(gimage2DMSArray image)
Returns separate integer and fractional parts: Returns a 2-component vector representation of v: Ti=int, ivecn. Tiu=int, ivecn, uint, uvecn.
Tfd modf(Tfd x, out Tfd i) uvec2 unpackDouble2x32(double v) Loads texel at the coordinate P from the image unit image:
Adds 32-bit uint x and y, returning the sum modulo 232:
Returns minimum value: Tu uaddCarry(Tu x, Tu y, out Tu carry) gvec4 imageLoad(readonly IMAGE_PARAMS)
Returns a uint by converting the components of a two-
Tfd min(Tfd x, Tfd y) Tiu min(Tiu x, Tiu y) component floating-point vector:
Subtracts y from x, returning the difference if non-negative, Stores data into the texel at the coordinate P from
Tf min(Tf x, float y) Ti min(Ti x, int y) uint packHalf2x16(vec2 v) the image specified by image:
otherwise 232 plus the difference:
Td min(Td x, double y) Tu min(Tu x, uint y) Returns a two-component floating-point vector: Tu usubBorrow(Tu x, Tu y, out Tu borrow) void imageStore(writeonly IMAGE_PARAMS, gvec4 data)
vec2 unpackHalf2x16(uint v) (Continue ) (Continued on next page)
(Continue )

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry


Page 12 OpenGL Shading Language 4.50 Reference Card
Built-In Functions (cont.) Image Functions (cont.) Interpolation fragment-processing functions Geometry Shader Functions (cont’d)
Image Functions (cont.) Copies the value of data: Return value of interpolant sampled inside pixel and the Emits values of output variables to the current output
Adds the value of data to the contents of the selected texel: uint imageAtomicExchange(coherent IMAGE_PARAMS, primitive: primitive:
uint imageAtomicAdd(coherent IMAGE_PARAMS, uint data) uint data) Tf interpolateAtCentroid(Tf interpolant) void EmitVertex()
int imageAtomicAdd(coherent IMAGE_PARAMS, int data) int imageAtomicExchange(coherent IMAGE_PARAMS,
Return value of interpolant at location of sample # sample:
int data) Completes output primitive and starts a new one:
Takes the minimum of the value of data and the contents Tf interpolateAtSample(Tf interpolant, int sample)
int imageAtomicExchange(coherent IMAGE_PARAMS, void EndPrimitive()
of the selected texel: float data)
uint imageAtomicMin(coherent IMAGE_PARAMS, uint data) Return value of interpolant sampled at fixed offset offset
Compares the value of compare and contents of selected
from pixel center:
int imageAtomicMin(coherent IMAGE_PARAMS, int data) texel. If equal, the new value is given by data; otherwise, Other Shader Functions [8.16-17]
it is taken from the original value loaded from texel: Tf interpolateAtOffset(Tf interpolant, vec2 offset) See diagram on page 11 for more information.
Takes the maximum of the value data and the contents
of the selected texel: uint imageAtomicCompSwap(coherent IMAGE_PARAMS,
uint compare, uint data) Synchronizes across shader invocations:
uint imageAtomicMax(coherent IMAGE_PARAMS, uint data) Noise Functions [8.14] void barrier()
int imageAtomicCompSwap(coherent IMAGE_PARAMS,
int imageAtomicMax(coherent IMAGE_PARAMS, int data) int compare, int data) Returns noise value. Available to fragment, geometry,
and vertex shaders. n is 2, 3, or 4: Controls ordering of memory transactions issued by a
Performs a bit-wise AND of the value of data and the
contents of the selected texel: Fragment Processing Functions [8.13] float noise1(Tf x) vecn noisen(Tf x) single shader invocation:
Available only in fragment shaders. void memoryBarrier()
uint imageAtomicAnd(coherent IMAGE_PARAMS, uint data) Tf=float, vecn.
int imageAtomicAnd(coherent IMAGE_PARAMS, int data) Derivative fragment-processing functions Controls ordering of memory transactions as viewed by
Geometry Shader Functions [8.15] other invocations in a compute work group:
Performs a bit-wise OR of the value of data and the Tf dFdx(Tf p) derivative in x and y, either Only available in geometry shaders.
contents of the selected texel: Tf dFdy(Tf p) fine or coarse derivatives void groupMemoryBarrier()
Emits values of output variables to current output
uint imageAtomicOr(coherent IMAGE_PARAMS, uint data) Tf dFdxFine(Tf p) fine derivative in x and y per primitive stream stream:
Tf dFdyFine(Tf p) pixel-row/column derivative Order reads and writes accessible to other invocations:
int imageAtomicOr(coherent IMAGE_PARAMS, int data) void EmitStreamVertex(int stream) void memoryBarrierAtomicCounter()
Tf dFdxCoarse(Tf p) coarse derivative in x and y per
Performs a bit-wise exclusive OR of the value of data and Tf dFdyCoarse(Tf p) 2x2-pixel derivative void memoryBarrierShared()
the contents of the selected texel: Completes current output primitive stream stream and
void memoryBarrierBuffer()
Tf fwidth(Tf p) starts a new one:
uint imageAtomicXor(coherent IMAGE_PARAMS, uint data) Tf fwidthFine(Tf p) sum of absolute values of x and y void memoryBarrierImage()
derivatives void EndStreamPrimitive(int stream)
int imageAtomicXor(coherent IMAGE_PARAMS, int data) Tf fwidthCoarse(Tf p)
(Continue ) (Continue )

Texture Functions [8.9] Texel Lookup Functions [8.9.2] Projective texture lookup with offset added before
Use texture coordinate P to do a lookup in the texture texture lookup.
Texture lookup both projectively as in
textureProj, and with explicit gradient as in
Available to vertex, geometry, and fragment
bound to sampler. For shadow forms, compare is textureGrad.
shaders. gvec4=vec4, ivec4, uvec4. gvec4 textureProjOffset(gsampler{1D,2D[Rect],3D} sampler,
gsampler* =sampler*, isampler*, usampler*.
used as Dref and the array layer comes from P.w.
For non-shadow forms, the array layer comes from vec{2,3,4} P, {int,ivec2,ivec3} offset [, float bias]) gvec4 textureProjGrad(gsampler{1D,2D[Rect],3D} sampler,
the last component of P. {vec2,vec3,vec4} P, {float,vec2,vec3} dPdx,
The P argument needs to have enough float textureProjOffset( {float,vec2,vec3} dPdy)
components to specify each dimension, array gvec4 texture( sampler{1D,2D[Rect]}Shadow sampler, vec4 P,
layer, or comparison for the selected sampler. gsampler{1D[Array],2D[Array,Rect],3D,Cube[Array]} sampler, float textureProjGrad(sampler{1D,2D[Rect]}Shadow sampler,
{int,ivec2} offset [, float bias]) vec4 P, {float,vec2} dPdx, {float,vec2} dPdy)
The dPdx and dPdy arguments need enough {float,vec2,vec3,vec4} P [, float bias])
components to specify the derivative for each
dimension of the sampler. float texture( Offset texture lookup with explicit LOD. Texture lookup projectively and with explicit gradient
sampler{1D[Array],2D[Array,Rect],Cube}Shadow sampler, as in textureProjGrad, as well as with offset as in
Texture Query Functions [8.9.1] {vec3,vec4} P [, float bias]) gvec4 textureLodOffset(
textureOffset.
textureSize functions return dimensions of lod float texture(gsamplerCubeArrayShadow sampler, vec4 P, gsampler{1D[Array],2D[Array],3D} sampler,
(if present) for the texture bound to sampler. float compare) {float,vec2,vec3} P, float lod, {int,ivec2,ivec3} offset) gvec4 textureProjGradOffset(
Components in return value are filled in with the gsampler{1D,2D[Rect],3D} sampler, vec{2,3,4} P,
Texture lookup with projection. float textureLodOffset( {float,vec2,vec3} dPdx, {float,vec2,vec3} dPdy,
width, height, depth of the texture. For array sampler{1D[Array],2D}Shadow sampler, vec3 P, float lod, {int,ivec2,ivec3} offset)
forms, the last component of the return value is gvec4 textureProj(gsampler{1D,2D[Rect],3D} sampler, {int,ivec2} offset)
the number of layers in the texture array. float textureProjGradOffset(
vec{2,3,4} P [, float bias]) sampler{1D,2D[Rect]Shadow} sampler, vec4 P,
{int,ivec2,ivec3} textureSize( float textureProj(sampler{1D,2D[Rect]}Shadow sampler, Projective texture lookup with explicit LOD. {float,vec2} dPdx, {float,vec2} dPdy, {ivec2,int,vec2} offset)
gsampler{1D[Array],2D[Rect,Array],Cube} sampler[, vec4 P [, float bias])
int lod]) gvec4 textureProjLod(gsampler{1D,2D,3D} sampler, Texture Gather Instructions [8.9.3]
{int,ivec2,ivec3} textureSize( Texture lookup as in texture but with explicit LOD. vec{2,3,4} P, float lod) These functions take components of a floating-point
gsampler{Buffer,2DMS[Array]}sampler) vector operand as a texture coordinate, determine
gvec4 textureLod( float textureProjLod(sampler{1D,2D}Shadow sampler,
{int,ivec2,ivec3} textureSize( gsampler{1D[Array],2D[Array],3D,Cube[Array]} sampler, vec4 P, float lod) a set of four texels to sample from the base level of
sampler{1D, 2D, 2DRect,Cube[Array]}Shadow sampler[, {float,vec2,vec3} P, float lod) detail of the specified texture image, and return one
int lod]) component from each texel in a four-component
ivec3 textureSize(samplerCubeArray sampler, int lod) float textureLod(sampler{1D[Array],2D}Shadow sampler, Offset projective texture lookup with explicit LOD.
vec3 P, float lod) result vector.
gvec4 textureProjLodOffset(gsampler{1D,2D,3D} sampler, gvec4 textureGather(
textureQueryLod functions return the mipmap Offset added before texture lookup. vec{2,3,4} P, float lod, {int, ivec2, ivec3} offset) gsampler{2D[Array,Rect],Cube[Array]} sampler,
array(s) that would be accessed in the x {vec2,vec3,vec4} P [, int comp])
component of the return value. Returns the gvec4 textureOffset( float textureProjLodOffset(sampler{1D,2D}Shadow sampler,
vec4 P, float lod, {int, ivec2} offset) vec4 textureGather(
computed level of detail relative to the base level gsampler{1D[Array],2D[Array,Rect],3D} sampler, sampler{2D[Array,Rect],Cube[Array]}Shadow sampler,
in the y component of the return value. {float,vec2,vec3} P, {int,ivec2,ivec3} offset [, float bias]) {vec2,vec3,vec4} P, float refZ)
vec2 textureQueryLod( float textureOffset( Texture lookup as in texture but with explicit gradients.
gsampler{1D[Array],2D[Array],3D,Cube[Array]} sampler, sampler{1D[Array],2D[Rect,Array]}Shadow sampler, Texture gather as in textureGather by offset as
{float,vec2,vec3} P) {vec3, vec4} P, {int,ivec2} offset [, float bias]) gvec4 textureGrad( described in textureOffset except minimum and
gsampler{1D[Array],2D[Rect,Array],3D,Cube[Array]} sampler, maximum offset values are given by
vec2 textureQueryLod(
sampler{1D[Array],2D[Array],Cube[Array]}Shadow sampler, Use integer texture coordinate P to lookup a single {float, vec2, vec3,vec4} P, {float, vec2, vec3} dPdx, {MIN, MAX}_PROGRAM_TEXTURE_GATHER_OFFSET.
{float,vec2,vec3} P) {float, vec2, vec3} dPdy)
texel from sampler.
float textureGrad( gvec4 textureGatherOffset(gsampler2D[Array,Rect] sampler,
textureQueryLevels functions return the number gvec4 texelFetch( {vec2,vec3} P, ivec2 offset [, int comp])
sampler{1D[Array],2D[Rect,Array], Cube}Shadow sampler,
of mipmap levels accessible in the texture gsampler{1D[Array],2D[Array,Rect],3D} sampler, {vec3,vec4} P, {float,vec2} dPdx, {float,vec2, vec3} dPdy) vec4 textureGatherOffset(
associated with sampler. {int,ivec2,ivec3} P[, {int,ivec2} lod]) sampler2D[Array,Rect]Shadow sampler,
gvec4 texelFetch(gsampler{Buffer, 2DMS[Array]} sampler, {vec2,vec3} P, float refZ, ivec2 offset)
int textureQueryLevels( Texture lookup with both explicit gradient and offset.
gsampler{1D[Array],2D[Array],3D,Cube[Array]} sampler) {int,ivec2,ivec3} P[, int sample])
gvec4 textureGradOffset( Texture gather as in textureGatherOffset except offsets
int textureQueryLevels( gsampler{1D[Array],2D[Rect,Array],3D} sampler, determines location of the four texels to sample.
sampler{1D[Array],2D[Array],Cube[Array]}Shadow sampler) Fetch single texel with offset added before texture lookup. {float,vec2,vec3} P, {float,vec2,vec3} dPdx,
gvec4 texelFetchOffset( {float,vec2,vec3} dPdy, {int,ivec2,ivec3} offset) gvec4 textureGatherOffsets(gsampler2D[Array,Rect] sampler,
textureSamples returns the number of samples gsampler{1D[Array],2D[Array],3D} sampler, {vec2,vec3} P, ivec2 offsets[4] [, int comp])
of the texture. float textureGradOffset(
{int,ivec2,ivec3} P, int lod, {int,ivec2,ivec3} offset) vec4 textureGatherOffsets(
sampler{1D[Array],2D[Rect,Array]}Shadow sampler,
int textureSamples(gsampler2DMS sampler) gvec4 texelFetchOffset( {vec3,vec4} P, {float,vec2} dPdx, {float,vec2}dPdy, sampler2D[Array,Rect]Shadow sampler,
gsampler2DRect sampler, ivec2 P, ivec2 offset) {int,ivec2} offset) {vec2,vec3} P, float refZ, ivec2 offsets[4])
int textureSamples(gsampler2DMSArray sampler)

©2014 Khronos Group - Rev. 0814 www.opengl.org/registry



OpenGL 4.5 API Reference Card Page 13
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 CreateTransformFeedbacks 5 GetActiveAtomicCounterBuffer* 2 L SamplerParameter* 2
ActiveShaderProgram 2 CreateVertexArrays 4 GetActiveAttrib 5 Layout Qualifiers 9 Sampler Queries 2
ActiveTexture 2 CullFace 5 GetActiveSubroutine* 2 LineWidth 5 Scissor* 6
Angle Functions 11 GetActiveUniform* 2 LinkProgram 2 Shaders and Programs 1-2
Asynchronous Queries 1 D GetAttachedShaders 2 LogicOp 6 Shader Functions 12
Atomic Functions 11 DebugMessage* 6 GetAttribLocation 5 Shader[Binary, Source] 1
AttachShader 2 DeleteBuffers 1 GetBoolean* 6 M ShadersStorageBlockBinding 2
DeleteFramebuffers 4 GetBufferParameter* 1 Macros 9 Shading Language 9-12
B DeleteProgram[Pipelines] 2 GetBuffer{Pointerv, SubData} 1 Map[Named]Buffer* 1 State and State Requests 6-7
BeginConditionalRender 5 DeleteQueries 1 Get[n]CompressedTexImage 3 Matrix Operations 10 StencilFunc[Separate] 6
BeginQuery[Indexed] 1 DeleteRenderbuffers 4 GetCompressedTexSubImage 3 Matrix Functions 11 StencilMask[Separate] 6
BeginTransformFeedback 5 DeleteSamplers 2 GetCompressedTextureImage 3 MemoryBarrier 2 StencilOp[Separate] 6
BindAttribLocation 5 DeleteShader 1 GetDebugMessageLog 6 MemoryBarrier 12 Storage Qualifiers 9
BindBuffer* 1 DeleteSync 1 GetDouble* 6 Memory Qualifiers 10 Structures 10
BindBuffer[s]{Base, Range} 1 DeleteTextures 2 GetError 1 MinSampleShading 5 Subroutine Uniform Variables 2
BindFragDataLocation[Indexed] 5 DeleteTransformFeedbacks 5 GetFloat* 6 MultiDraw{Arrays, Elements}* 5 Subroutines 10
BindFramebuffer 4 DeleteVertexArrays 4 GetFragData* 5 Multisample Fragment Ops 6 Synchronization 1
BindImageTexture[s] 4 DepthFunc 6 GetFramebuffer* 4 Multisample Textures 3
BindProgramPipeline 2 DepthMask 6 GetGraphicsResetStatus 1 Multisampling 5 T
BindRenderbuffer 4 DepthRange* 5 GetInteger* 7 Tessellation Diagram 7
Bind{Sampler, Texture}[s] 2 Derivative Functions 12 GetInteger64* 7 N Tessellation Variables 10
BindTexture[s] 2 DetachShader 2 GetInternalformat* 7 NamedBuffer 1 TexBuffer* 3
BindTextureUnit 2 DisableVertexArrayAttrib 5 GetMultisamplefv 5 NamedFramebufferDraw 6 Texel Lookup Functions 12
BindTransformFeedback 5 DisableVertexAttribArray 5 GetNamedBuffer[Indexed] 1 NamedFramebuffer 4 TexImage*[Multisample] 3
BindVertexArray 4 DispatchCompute* 5 GetNamedFramebuffer 4 NamedFramebufferReadBuffer 6 TexParameter* 3
BindVertexBuffer[s] 4 Dithering 6 GetNamedRenderbuffer 4 NamedRenderbufferStorage 4 TexStorage* 3
BlendColor 6 DrawArrays* 5 GetObject[Ptr]Label 6 Noise Functions 12 TexStorage*[Multisample] 4
BlendEquation[Separate]* 6 DrawBuffer[s] 6 GetPointerv 6-7 TexSubImage* 3
BlendFunc[Separate]* 6 Draw[Range]Elements* 5 GetProgram* 2 O TextureBarrier 4
Blit[Named]Framebuffer 6 DrawTransformFeedback* 5 GetQuery* 1 Object[Ptr]Label 5 TextureBuffer[Range] 3
Buffer[Sub]Data 1 GetRenderbufferParameteriv 4 Occlusion Queries 6 Texture Functions 12
BufferStorage 1 E GetSamplerParameter* 2 Operators 9 Texture Queries 3
BufferTextures 3 EnableVertexArrayAttrib 5 GetShader* 2 TextureStorage*[Multisample] 4
EnableVertexAttribArray 5 GetString* 6 P TextureSubImage 3
C EndConditionalRender 5 GetSubroutine* 2 Pack/Unpack Functions 11 TextureView 3
Callback 6 EndQuery[Indexed] 1 GetSynciv 1 Parameter Qualifiers 10
Texture View/State Diagram 7
Check[Named]FramebufferStatus 4 EndQuery 6 Get[n]TexImage 3 PatchParameter 5
Timer Queries 1
ClampColor 6 EndTransformFeedback 5 GetTex[Level]Parameter* 3 PauseTransformFeedback 5
Transform Feedback 5
Clear 6 Errors 1 GetTexture* 3 Per-Fragment Operations 6
TransformFeedbackVaryings 5
Clear[Named]Buffer[Sub]Data 1 Exponential Functions 11 GetTransformFeedback 7 Pipeline Diagram 8
Types 9
ClearBuffer* 6 GetTransformFeedbackVarying 5 PixelStore{if} 2
F PointParameter* 5
ClearColor 6 Get[n]Uniform 2 U
Feedback Loops 4 PointSize 5
ClearDepth* 6 GetUniform* 2 Uniform Qualifiers 9-10
FenceSync 1 Polygon{Mode, Offset} 5
ClearStencil 6 GetVertex{Array, Attrib}* 5 Uniform Variables 2
Finish 1 {Pop, Push}DebugGroup 6
ClearTex[Sub]Image 4 GL Command Syntax 1 Uniform* 2
Flatshading 5 Precise & Precision Qualifiers 10
ClientWaitSync 1 UniformBlockBinding 2
Floating-Point Pack/Unpack Func. 11 Preprocessor 9
Clip Control 5 H Uniform[Matrix]* 2
Flush 1 Primitive Clipping 5
ColorMask* 6 Hint 6 UniformSubroutinesuiv 2
FlushMapped* 1 PrimitiveRestartIndex 5
Command Letters 1 Unmap[Named]Buffer 1
Fragment Language Variables 10 ProgramBinary 2
Common Functions 11 I UseProgram[Stages] 2
Fragment Processing Functions 12 Program Objects 2
CompileShader 1 Image Functions 11
Fragment Shaders 5 ProgramParameteri 2
CompressedTex[Sub]Image* 3 Integer Functions 11 V
Framebuffer Objects 4 ProgramUniform[Matrix]* 2
CompressedTextureSubImage* 3 Interpolation Functions 12 ValidateProgram[Pipeline] 5
FramebufferParameteri 4 ProvokingVertex 5
Compute Language Variables 10 Interpolation Qualifiers 10 Vector & Matrix 10
FramebufferRenderbuffer 4
Compute Programming Diagram 7 InvalidateBuffer* 1 Vector Relational Functions 11
FramebufferTexture* 4 Q
Compute Shaders 5 Invalidate[Sub]Framebuffer 6 Vertex & Tessellation Diagram 8
FrontFace 5 Qualifiers 9
Constants 10 InvalidateNamedFramebuffer 6 Vertex Arrays 4-5
Conversions 6 G InvalidateTex[Sub]Image 4 QueryCounter 1
VertexAttrib* 4
Copy[Named]BufferSubData 1 Invariant Qualifiers 10 Vertex[Array]Attrib* 4
GenBuffers 1
CopyImageSubData 6 IsBuffer 1 R VertexArrayBindingDivisor 5
Generate[Texture]Mipmap 3
CopyTex[Sub]Image* 3 GenFramebuffers 4 IsFramebuffer 4 Rasterization 5 VertexArray*Buffer 4
CopyTextureSubImage* 3 GenProgramPipelines 2 IsProgram[Pipeline] 5 ReadBuffer 6 VertexAttrib*Format 4
CreateBuffers 1 GenQueries 1 IsQuery 1 Read[n]Pixels 6 VertexAttrib*Pointer 5
CreateFrameBuffers 4 GenRenderbuffers 4 IsRenderbuffer 4 ReleaseShaderCompiler 1 VertexAttrib[Binding, Divisor] 4-5
CreateProgram[Pipelines] 2 GenSamplers 2 IsSampler 2 Renderbuffer Object Queries 4 VertexBindingDivisor 4
CreateQueries* 1 GenTextures 2 IsShader 1 RenderbufferStorage* 4 Vertex Language Variables 10
CreateRenderBuffers 4 GenTransformFeedbacks 4 IsSync 1 ResumeTransformFeedback 5 Viewport* 5
CreateSamplers* 2 GenVertexArrays 4 IsTexture 2
CreateShader 1 Geometric Functions 11 IsTransformFeedback 5 S W
CreateShaderProgramv 2 Geometry & Follow-on Diagram 8 IsVertexArray 4 SampleCoverage 5
WaitSync 1
Createtextures* 2 Geometry Shader Functions 12 Iteration and Jumps 10 SampleMaski 5

OpenGL is a registered trademark of Silicon Graphics International, used under license by Khronos Group.
The Khronos Group is an industry consortium creating open standards for the authoring and acceleration
of parallel computing, graphics and dynamic media on a wide variety of platforms and devices.
See www.khronos.org to learn more about the Khronos Group.
See www.opengl.org to learn more about OpenGL.

©2014 Khronos Group - Rev. 0814 Reference card production by Miller & Mattson www.millermattson.com www.opengl.org/registry

Das könnte Ihnen auch gefallen