Beruflich Dokumente
Kultur Dokumente
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)
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)
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)
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)
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
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)
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 int gl_PrimitiveID;
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
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)
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