Opengl46 Quick Reference Card
Opengl46 Quick Reference Card
Command Execution [2.3] Floating-Point Numbers [2.3.4] OpenGL Command Syntax [2.2]
16-Bit 1-bit sign, 5-bit exp., 10-bit mant. GL commands are formed from a return type, a name, and optionally up to 4 characters
OpenGL Errors [2.3.1] (or character pairs) from the Command Letters table (to the left), as shown by the prototype:
enum GetError(void); Unsigned 11-Bit no sign bit, 5-bit exp., 6-bit mant.
Graphics Reset Recovery [2.3.2] Unsigned 10-Bit no sign bit, 5-bit exp., 5-bit mant. return-type Name{1234}{b s i i64 f d ub us ui ui64}{v} ([args ,] T arg1 , . . . , T argN [, args]);
enum GetGraphicsResetStatus(void); Command Letters [Tables 2.1, 2.2] The arguments enclosed in brackets ([args ,] and [, args]) may or may not be present.
Returns: NO_ERROR, GUILTY_CONTEXT_RESET, Where a letter denotes a type in a function
{INNOCENT, UNKNOWN}_CONTEXT_RESET name, T within the prototype is the same type. The argument type T and the number N of arguments may be indicated by the command name
GetIntegerv(RESET_NOTIFICATION_STRATEGY); b - byte (8 bits) suffixes. N is 1, 2, 3, or 4 if present. If “v” is present, an array of N items is passed by a pointer.
ub - ubyte (8 bits) For brevity, the OpenGL documentation and this reference may omit the standard prefixes.
Returns: NO_RESET_NOTIFICATION, s - short (16 bits) us - ushort (16 bits)
LOSE_CONTEXT_ON_RESET The actual names are of the forms: glFunctionName(), GL_CONSTANT, GLtype
i - int (32 bits) ui - uint (32 bits)
Flush and Finish [2.3.3] i64 - int64 (64 bits) ui64 - uint64 (64 bits)
void Flush(void); void Finish(void); f - float (32 bits) d - double (64 bits)
Asynchronous Queries [4.2, 4.2.1] void EndQueryIndexed(enum target,
void GenQueries(sizei n, uint *ids); uint index);
Timer Queries [4.3] void QueryCounter(uint id, TIMESTAMP); void CreateQueries(enum target, sizei n, boolean IsQuery(uint id);
Timer queries track the amount of time needed void GetIntegerv(TIMESTAMP, int *data); uint *ids); void GetQueryiv(enum target, enum pname,
to fully complete a set of GL commands. void GetInteger64v(TIMESTAMP, int64 *data); target: See BeginQuery, plus TIMESTAMP int *params);
void DeleteQueries(sizei n, const uint *ids); target: See BeginQuery, plus TIMESTAMP
pname: CURRENT_QUERY, QUERY_COUNTER_BITS
Synchronization Waiting for Sync Objects [4.1.1] void BeginQuery(enum target, uint id);
void GetQueryIndexediv(enum target,
Sync Objects and Fences [4.1] enum ClientWaitSync(sync sync, target: ANY_SAMPLES_PASSED[_CONSERVATIVE],
bitfield flags, uint64 timeout_ns); PRIMITIVES_GENERATED, SAMPLES_PASSED, uint index, enum pname, int *params);
void DeleteSync(sync sync); TIME_ELAPSED, {PRIMITIVES, VERTICES}_SUBMITTED, target: See BeginQuery, plus TIMESTAMP
flags: SYNC_FLUSH_COMMANDS_BIT, or zero
sync FenceSync(enum condition, bitfield flags); TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, pname: CURRENT_QUERY, QUERY_COUNTER_BITS
condition: SYNC_GPU_COMMANDS_COMPLETE
void WaitSync(sync sync, bitfield flags, TRANSFORM_FEEDBACK_[STREAM_]OVERFLOW,
uint64 timeout); {COMPUTE, VERTEX}_SHADER_INVOCATIONS, void GetQueryObjectiv(uint id, enum pname,
flags: must be 0 int *params);
timeout: TIMEOUT_IGNORED {FRAGMENT, GEOMETRY}_SHADER_INVOCATIONS,
Sync Object Queries [4.1.3] TESS_EVALUATION_SHADER_INVOCATIONS, void GetQueryObjectuiv(uint id,
Buffer Objects [6] void GetSynciv(sync sync, enum pname,
TESS_CONTROL_SHADER_PATCHES,
GEOMETRY_SHADER_PRIMITIVES_EMITTED,
enum pname, uint *params);
void GenBuffers(sizei n, uint *buffers); sizei bufSize, sizei *length, int *values); CLIPPING_{INPUT, OUTPUT}_PRIMITIVES void GetQueryObjecti64v(uint id,
void CreateBuffers(sizei n, uint *buffers); pname: OBJECT_TYPE, SYNC_{STATUS, CONDITION, FLAGS}
void BeginQueryIndexed(enum target, enum pname, int64 *params);
void DeleteBuffers(sizei n, const uint *buffers); boolean IsSync(sync sync); uint index, uint id); void GetQueryObjectui64v(uint id,
Create and Bind Buffer Objects [6.1] target: See BeginQuery enum pname, uint64 *params);
void BindBuffer(enum target, uint buffer); void BufferSubData(enum target, void EndQuery(enum target); pname: QUERY_TARGET,
target: [Table 6.1] {ARRAY, UNIFORM}_BUFFER, intptr offset, sizeiptr size, QUERY_RESULT[_NO_WAIT, _AVAILABLE]
{ATOMIC_COUNTER, QUERY}_BUFFER, const void *data);
COPY_{READ, WRITE}_BUFFER, target: See BindBuffer
{DISPATCH, DRAW}_INDIRECT_BUFFER, void NamedBufferSubData(uint buffer, void *MapBuffer(enum target, enum access); void GetBufferParameteri[64]v(
{ELEMENT_ARRAY, TEXTURE}_BUFFER, intptr offset, sizeiptr size, access: See MapBufferRange enum target, enum pname, int[64]*data);
PIXEL_[UN]PACK_BUFFER, const void *data); void *MapNamedBuffer(uint buffer, target: See BindBuffer
{PARAMETER, SHADER_STORAGE}_BUFFER, pname: [Table 6.2] BUFFER_SIZE, BUFFER_USAGE,
TRANSFORM_FEEDBACK_BUFFER void ClearBufferSubData(enum target, enum access);
BUFFER_{ACCESS[_FLAGS]}, BUFFER_MAPPED,
enum internalFormat, intptr offset, access: See MapBufferRange BUFFER_MAP_{OFFSET, LENGTH},
void BindBufferRange(enum target, sizeiptr size, enum format, enum type,
uint index, uint buffer, intptr offset, void FlushMappedBufferRange(intptr offset, BUFFER_{IMMUTABLE_STORAGE, ACCESS_FLAGS}
const void *data); sizeiptr length);
sizeiptr size); target: See BindBuffer void GetNamedBufferParameteri[64]v(
target: ATOMIC_COUNTER_BUFFER, internalformat: See TexBuffer on pg. 3 of this card void FlushMappedNamedBufferRange( uint buffer, enum pname, int[64]*data);
{SHADER_STORAGE, UNIFORM}_BUFFER, uint buffer, intptr offset, sizeiptr length);
TRANSFORM_FEEDBACK_BUFFER format: RED, GREEN, BLUE, RG, RGB, RGBA, BGR, void GetBufferPointerv(enum target,
BGRA, {RED, GREEN, BLUE, RG, RGB}_INTEGER, boolean UnmapBuffer(enum target); enum pname, const void **params);
void BindBufferBase(enum target, {RGBA, BGR, BGRA} _INTEGER, STENCIL_INDEX, target: See BindBuffer target: See BindBuffer
uint index, uint buffer); DEPTH_{COMPONENT, STENCIL} boolean UnmapNamedBuffer(uint buffer); pname: BUFFER_MAP_POINTER
target: See BindBufferRange void ClearNamedBufferSubData(
Invalidate Buffer Data [6.5] void GetNamedBufferPointerv(uint buffer,
void BindBuffersRange(enum target, uint buffer, enum internalFormat, enum pname, const void **params);
uint first, sizei count, const uint *buffers, intptr offset, sizeiptr size, enum format, void InvalidateBufferSubData(uint buffer,
enum type, const void *data); intptr offset, sizeiptr length); pname: BUFFER_MAP_POINTER
const intptr *offsets, const sizeiptr *size);
target: See BindBufferRange internalformat, format, type: See Copy Between Buffers [6.6]
ClearBufferSubData void InvalidateBufferData(uint buffer);
void BindBuffersBase(enum target, void CopyBufferSubData(enum readTarget,
uint first, sizei count, void ClearBufferData(enum target, Buffer Object Queries [6, 6.7] enum writeTarget, intptr readOffset,
const uint *buffers); enum internalformat, enum format, boolean IsBuffer(uint buffer); intptr writeOffset, sizeiptr size);
target: See BindBufferRange
enum type, const void *data); readTarget and writeTarget: See BindBuffer
target, internalformat, format: See void GetBufferSubData(enum target,
Create/Modify Buffer Object Data [6.2] ClearBufferSubData intptr offset, sizeiptr size, void *data); void CopyNamedBufferSubData(
target: See BindBuffer uint readBuffer, uint writeBuffer,
void BufferStorage(enum target, void ClearNamedBufferData(uint buffer, intptr readOffset, intptr writeOffset,
sizeiptr size, const void *data, enum internalformat, enum format, void GetNamedBufferSubData(uint buffer, sizeiptr size);
bitfield flags); enum type, const void *data); intptr offset, sizeiptr size, void *data);
target: See BindBuffer internalformat, format, type: See ClearBufferData
flags: Bitwise OR of MAP_{READ, WRITE}_BIT,
{DYNAMIC, CLIENT}_STORAGE_BIT, Map/Unmap Buffer Data [6.3] Shaders and Programs boolean IsShader(uint shader);
MAP_{COHERENT, PERSISTENT}_BIT void *MapBufferRange(enum target, void ShaderBinary(sizei count,
void NamedBufferStorage(uint buffer, intptr offset, sizeiptr length, Shader Objects [7.1-2] const uint *shaders, enum binaryformat,
sizeiptr size, const void *data, bitfield access); uint CreateShader(enum type); const void *binary, sizei length);
target: See BindBuffer
bitfield flags); type: {COMPUTE, FRAGMENT}_SHADER, void SpecializeShader(uint shader,
access: The Bitwise OR of MAP_X_BIT, where X may {GEOMETRY, VERTEX}_SHADER,
flags: See BufferStorage be READ, WRITE, PERSISTENT, COHERENT, const char *pEntryPoint,
TESS_{EVALUATION, CONTROL}_SHADER uint numSpecializationConstants,
void BufferData(enum target, sizeiptr size, INVALIDATE_{BUFFER, RANGE},
const void *data, enum usage); FLUSH_EXPLICIT, UNSYNCHRONIZED void ShaderSource(uint shader, sizei count, const uint *pConstantIndex,
target: See BindBuffer const char * const * string, const int const int *pConstantValue );
void *MapNamedBufferRange(uint buffer,
usage: DYNAMIC_{DRAW, READ, COPY}, intptr offset, sizeiptr length, *length);
Program Objects [7.3]
{STATIC, STREAM}_{DRAW, READ, COPY} bitfield access); void CompileShader(uint shader); uint CreateProgram(void);
void NamedBufferData(uint buffer, sizeiptr target: See BindBuffer
access: See MapBufferRange void ReleaseShaderCompiler(void); void AttachShader(uint program, uint shader);
size, const void *data, enum usage);
void DeleteShader(uint shader); (Continued on next page)
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(
texture: TEXTUREi (where i is uint *textures); void SamplerParameter{i f}v(uint sampler, uint sampler, enum pname, T *params);
[0, max(MAX_TEXTURE_COORDS, target: See BindTexture enum pname, const T *param); pname: See SamplerParameter{if}
MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1]) void GetSamplerParameterI{i ui}v(
void DeleteTextures(sizei n, void SamplerParameterI{i ui}v(uint sampler,
Texture Objects [8.1] const uint *textures); enum pname, const T *params); uint sampler, enum pname, T *params);
void GenTextures(sizei n, uint *textures); pname: for all SamplerParameter* functions: pname: See SamplerParameter{if}
boolean IsTexture(uint texture);
TEXTURE_X where X may be WRAP_{S, T, R},
void BindTexture(enum target, uint texture); Pixel Storage Modes [8.4.1]
Sampler Objects [8.2] {MIN, MAG}_FILTER, {MIN, MAX}_LOD,
void PixelStore{i f}(enum pname, T param);
target: TEXTURE_{1D, 2D}[_ARRAY], void GenSamplers(sizei count, uint *samplers); BORDER_COLOR, LOD_BIAS, MAX_ANISOTROPY
TEXTURE_{3D, RECTANGLE, BUFFER}, COMPARE_{MODE, FUNC} [Table 23.18] pname: [Tables 8.1, 18.1] [UN]PACK_X where X may
TEXTURE_CUBE_MAP[_ARRAY], void CreateSamplers(sizei n, uint *samplers); be SWAP_BYTES, LSB_FIRST, ROW_LENGTH,
TEXTURE_2D_MULTISAMPLE[_ARRAY] void DeleteSamplers(sizei count, SKIP_{IMAGES, PIXELS, ROWS}, ALIGNMENT,
void BindSampler(uint unit, uint sampler); const uint *samplers); IMAGE_HEIGHT, COMPRESSED_BLOCK_WIDTH,
void BindTextures(uint first, sizei count, COMPRESSED_BLOCK_{HEIGHT, DEPTH, SIZE}
const uint *textures); void BindSamplers(uint first, sizei count, boolean IsSampler(uint sampler);
target: See BindTexture const uint *samplers); (Continued on next page)
©2017 Khronos Group - Rev. 0717 www.khronos.org/opengl
OpenGL 4.6 API Reference Guide 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,
{RG, RGB, RGBA, BGR}_INTEGER, void TextureBuffer(uint texture, level: LOD level
sizei imageSize, const void *data);
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 for all TexParameter* functions:
enum format, enum type, const void *data); target: TEXTURE_1D, PROXY_TEXTURE_1D level, format, type: See GetTextureImage
DEPTH_STENCIL_TEXTURE_MODE or
target: TEXTURE_1D, PROXY_TEXTURE_1D internalformat: See TexImage1D, omitting TEXTURE_X where X may be one of void GetCompressedTexImage(enum target,
type, internalformat, format: See TexImage3D compressed rectangular texture formats WRAP_{S, T, R}, BORDER_COLOR, int level, void *pixels);
{MIN, MAG}_FILTER, LOD_BIAS,{MIN, MAX}_LOD, target: See GetTextureImage
Alternate Texture Image Spec. [8.6] void CompressedTexSubImage3D( {BASE, MAX}_LEVEL, SWIZZLE_{R, G, B, A, RGBA},
enum target, int level, int xoffset, COMPARE_{MODE, FUNC} [Table 8.17] void
void CopyTexImage2D(enum target, int yoffset, int zoffset, sizei width,
int level, enum internalformat, int x, GetCompressedTextureImage(uint texture,
sizei height, sizei depth, enum format, void TextureParameter{i f}(uint texture, int level, sizei bufSize, void *pixels);
int y, sizei width, sizei height, int border); sizei imageSize, const void *data); enum pname, T param);
target: TEXTURE_{2D, RECTANGLE, 1D_ARRAY}, level: See GetTextureImage
target: See TexSubImage3D pname: See BindTexture
TEXTURE_CUBE_MAP_{POSITIVE, NEGATIVE}_{X, Y, Z} format: See internalformat for void GetnCompressedTexImage(enum target,
internalformat: See TexImage3D CompressedTexImage3D void TextureParameter{i f}v(uint texture, int level, sizei bufsize, void *pixels);
void CompressedTexSubImage2D( enum pname, const T *params); target: See GetCompressedTexImage
void CopyTexImage1D(enum target,
int level, enum internalformat, int x, enum target, int level, int xoffset, pname: See BindTexture level: LOD level
int y, sizei width, int border); int yoffset, sizei width, sizei height, void TextureParameterI{i ui}v(uint texture, void GetCompressedTextureSubImage(
target: TEXTURE_1D enum format, sizei imageSize, enum pname, const T *params); uint texture, int level, int xoffset, int yoffset,
internalformat: See TexImage3D cont void *data); int zoffset, sizei width, sizei height,
target: See TexSubImage2D pname for all TextureParameter* functions:
void TexSubImage3D(enum target, int level, TEXTURE_{3D, RECTANGLE, MAX_ANISOTROPY}, sizei depth, sizei bufSize, void *pixels);
format: See internalformat for
int xoffset, int yoffset, int zoffset, CompressedTexImage2D TEXTURE_{1D, 2D, CUBE_MAP}[_ARRAY], level: LOD level
sizei width, sizei height, sizei depth, TEXTURE_2D_MULTISAMPLE[_ARRAY]
void CompressedTexSubImage1D( Cube Map Texture Select [8.13.1]
enum format, enum type, enum target, int level, int xoffset, Texture Queries [8.11]
const void *data); Enable/Disable/IsEnabled(
sizei width, enum format, sizei imageSize, void GetTexParameter{if}v(enum target, TEXTURE_CUBE_MAP_SEAMLESS);
target: TEXTURE_3D, TEXTURE_2D_ARRAY, const void *data);
TEXTURE_CUBE_MAP_ARRAY enum pname, T * params);
target: See TexSubImage1D target: See BindTexture Manual Mipmap Generation [8.14.4]
format, type: See TexImage3D format: See internalformat for void GenerateMipmap(enum target);
pname: See GetTexParameterI{i ui}v
void TexSubImage2D(enum target, CompressedTexImage1D target: TEXTURE_{1D, 2D, 3D},
int level, int xoffset, int yoffset, sizei width, void CompressedTextureSubImage3D( void GetTexParameterI{i ui}v(enum target, TEXTURE_{1D, 2D}_ARRAY,
sizei height, enum format, enum type, uint texture, int level, int xoffset, enum pname, T * params); TEXTURE_CUBE_MAP[_ARRAY]
const void *data); int yoffset, int zoffset, sizei width, target: See BindTexture void GenerateTextureMipmap(uint texture);
target: See CopyTexImage2D sizei height, sizei depth, enum format, pname: IMAGE_FORMAT_COMPATIBILITY_TYPE,
format, type: See TexImage3D sizei imageSize, const void *data); TEXTURE_IMMUTABLE_{FORMAT, LEVELS}, Texture Views [8.18]
format: See internalformat for TEXTURE_VIEW_MIN_{LEVEL, LAYER}, void TextureView(uint texture, enum target,
void TexSubImage1D(enum target, int level, TEXTURE_VIEW_NUM_{LEVELS, LAYERS},
int xoffset, sizei width, enum format, CompressedTexImage3D uint origtexture, enum internalformat,
DEPTH_STENCIL_TEXTURE_MODE, or TEXTURE_X uint minlevel, uint numlevels, uint minlayer,
enum type, const void *data); void CompressedTextureSubImage2D( where X may be one of WRAP_{S, T, R},
target, format, type: See CopyTexImage1D uint texture, int level, int xoffset, uint numlayers);
BORDER_COLOR, TARGET, {MIN, MAG}_FILTER,
int yoffset, sizei width, sizei height, LOD_BIAS,{MIN, MAX}_LOD, {BASE, MAX}_LEVEL, target: TEXTURE_{1D, 2D,CUBE_MAP}[_ARRAY],
void CopyTexSubImage3D(enum target, enum format, sizei imageSize, SWIZZLE_{R, G, B, A, RGBA}, TEXTURE_3D, TEXTURE_RECTANGLE,
int level, int xoffset, int yoffset, int zoffset, cont void *data); COMPARE_{MODE, FUNC} [Table 8.17] TEXTURE_2D_MULTISAMPLE[_ARRAY]
int x, int y, sizei width, sizei height); format: See internalformat for internalformat:
target: See TexSubImage3D CompressedTexImage2D void GetTextureParameter{if}v(uint texture, R8, R8{UI, I}, R8_SNORM, R11F_G11F_B10F,
void CopyTexSubImage2D(enum target, enum pname, T *data); R16{F, UI, I}, R16[_SNORM],
void CompressedTextureSubImage1D( pname: See GetTexParameterI{i ui}v R32{F, UI, I}, SRGB8[UI, I],
int level, int xoffset, int yoffset, int x, uint texture, int level, int xoffset, RG8{F, UI, I}, RG8[_SNORM],
int y, sizei width, sizei height); sizei width, enum format, sizei imageSize, void GetTextureParameterI{i ui}v(uint texture, RG16{F, UI, I}, RG16[_SNORM], RG32{F, UI, I},
target: See TexImage2D const void *data); enum pname, T *data); RGB8[_SNORM], RGB9_E5, RGB10_A2[UI],
void CopyTexSubImage1D(enum target, format: See internalformat for pname: See GetTexParameterI{i ui}v RGBA8{UI, I}, RGBA8[_SNORM],
int level, int xoffset, int x, int y, sizei width); CompressedTexImage1D RGB16{F, UI, I}, RGB16[_SNORM], RGB32{F, UI, I},
target: See TexSubImage1D Multisample Textures [8.8] void GetTexLevelParameter{i f}v(enum target, RGBA16{F, UI, I}, RGBA16[_SNORM],
int level, enum pname, T *params); RGBA32{F, UI, I}, SRGB8_ALPHA8;
void TextureSubImage3D(uint texture, int level, void TexImage3DMultisample(enum target, target: [PROXY_]TEXTURE_{1D, 2D, 3D}, COMPRESSED_X where X may be
int xoffset, int yoffset, int zoffset, sizei samples, int internalformat, [SIGNED]_RED_RGTC1, [SIGNED]_RG_RGTC2,
sizei width, sizei height, sizei depth, TEXTURE_BUFFER, PROXY_TEXTURE_CUBE_MAP,
sizei width, sizei height, sizei depth, [PROXY_]TEXTURE_{1D, 2D,CUBE_MAP}_ARRAY, {RGBA, SRGB_ALPHA}_BPTC_UNORM,
enum format, enum type, boolean fixedsamplelocations); RGB_BPTC_[UN]SIGNED_FLOAT
target: [PROXY_]TEXTURE_2D_MULTISAMPLE_ARRAY [PROXY_]TEXTURE_RECTANGLE,
const void *pixels); TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
format, type: See TexImage3D internalformat: RED, RG, RGB, RGBA, RGBA{32, 32UI},
TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z}, 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} [PROXY_]TEXTURE_2D_MULTISAMPLE[_ARRAY]
pname: TEXTURE _*, where * may be WIDTH, enum internalformat, sizei width);
int xoffset, int yoffset, sizei width, void TexImage2DMultisample(enum target, target: TEXTURE_1D
sizei height, enum format, enum type, HEIGHT, DEPTH, FIXED_SAMPLE_LOCATIONS,
sizei samples, int internalformat, sizei width, INTERNAL_FORMAT, SHARED_SIZE, COMPRESSED, internalformat: any of the sized internal color, depth,
const void *pixels); sizei height, boolean fixedsamplelocations); COMPRESSED_IMAGE_SIZE, SAMPLES, and stencil formats in [Tables 8.18-20]
format, type: See TexImage3D target: [PROXY_]TEXTURE_2D_MULTISAMPLE BUFFER_{OFFSET, SIZE}, or X_{SIZE, TYPE}
internalformat: See TexImage3DMultisample where X can be RED, GREEN, BLUE, ALPHA, DEPTH (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(
RIGHT, FRONT_AND_BACK,
int drawbuffer, const T *value); uint framebuffer, sizei numAttachments,
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(
buf: See DrawBuffer
face: FRONT, BACK, FRONT_AND_BACK enumtarget, sizei numAttachments,
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);
(i = [0, MAX_COLOR_ATTACHMENTS - 1 ])
const void *userParam); Synchronous Debug Output [20.8]
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_MAX_ANISTOPY TEXTURE_SWIZZLE_{R,G,B,A} TEXTURE_MAX_LEVEL TEXTURE_{RED,GREEN,BLUE,ALPHA,DEPTH,STENCIL}_SIZE
TEXTURE_WRAP_{S,T,R} 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 iimage2DMSint. 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 Layout Qualifier Qualif. Indiv. Block
or input parameter
The following table summarizes the use of layout qualifiers applied to non- Only Var. Block Mem. Allowed Interfaces
const read-only variable opaque types and the kinds of declarations they may be applied to. origin_upper_left
FC
Op = Opaque types only, FC = gl_FragCoord only, FD = gl_FragDepth only. pixel_center_integer fragment in
in linkage into shader from previous stage
early_fragment_tests X
out linkage out of a shader to next stage Layout Qualifier Qualif. Indiv. Block
Only Var. Block Mem. Allowed Interfaces local_size_{x, y, z} = X compute in
shared, packed, std{140, 430} X X local_size_{x,y,z}_id = X compute in
linkage between a shader, OpenGL,
uniform {row, column}_major X X X xfb_{buffer, stride} = X X X X vertex, tessellation, and
and the application
binding = Op X uniform/buffer xfb_offset = X X X geometry out
buffer accessible by shaders and OpenGL API vertices = X tessellation control out
offset = X
compute shader only, shared among work align = X X [ points ], line_strip,
shared X
items in a local work group triangle_strip
uniform/buffer and geometry out
location = X max_vertices = X
subroutine variables
Auxiliary Storage Qualifiers stream = X X X X
location = X X X all in/out, except for
Use to qualify some input and output variables: depth_{any, greater, less,
component = X X compute FD fragment out
unchanged}
centroid centroid-based interpolation fragment out and scalar
index = X constant_id const
sampler per-sample interpolation subroutine functions only
patch per-tessellation-patch attributes triangles, quads, isolines X Opaque Uniform Layout Qualifiers [4.4.6]
equal_spacing, Used to bind opaque uniform variables to specific buffers or units.
fractional_even_spacing, X tessellation evaluation
Interface Blocks [4.3.9] binding = integer-constant-expression
fractional_odd_spacing in
in, out, uniform, and buffer variable cw, ccw X Atomic Counter Layout Qualifiers
declarations can be grouped. For example: point_mode X binding = integer-constant-expression
uniform Transform { points X geometry in/out offset = integer-constant-expression
// allowed restatement qualifier: [ points ], lines, triangles,
mat4 ModelViewMatrix; X geometry in
{triangles, lines}_adjacency
uniform mat3 NormalMatrix; invocations = X geometry in
}; (Continued on next page)
out gl_PerVertex { float gl_CullDistance[]; actual values are implementation-dependent, but const int gl_MaxTessControlUniformComponents = 1024;
vec4 gl_Position; } gl_in[]; must be at least the value shown. const int gl_MaxTessControlTotalOutputComponents = 4096;
Outputs
float gl_PointSize; in int gl_PrimitiveIDIn; const ivec3 gl_MaxComputeWorkGroupCount = const int gl_MaxTessEvaluationInputComponents = 128;
float gl_ClipDistance[]; in int gl_InvocationID; {65535, 65535, 65535} ; const int gl_MaxTessEvaluationOutputComponents = 128;
float gl_CullDistance[]; out gl_PerVertex { const ivec3 gl_MaxComputeWorkGroupSize[] =
}; vec4 gl_Position;
const int gl_MaxTessEvaluationTextureImageUnits = 16;
{1024, 1024, 64}; const int gl_MaxTessEvaluationUniformComponents = 1024;
float gl_PointSize;
Tessellation Control Language float gl_ClipDistance[]; const int gl_MaxComputeUniformComponents = 1024; const int gl_MaxTessPatchComponents = 120;
const int gl_MaxComputeTextureImageUnits = 16;
Outputs
float gl_CullDistance[]; in int gl_SampleID; const int gl_MaxCombinedTextureImageUnits = 80; const int gl_MaxAtomicCounterBindings = 1;
} gl_out[]; in vec2 gl_SamplePosition; const int gl_MaxTextureImageUnits = 16; const int gl_MaxVertexAtomicCounterBuffers = 0;
patch out float gl_TessLevelOuter[4]; in int gl_SampleMaskIn[]; const int gl_MaxImageUnits = 8;
in int gl_Layer; const int gl_MaxTessControlAtomicCounterBuffers = 0;
patch out float gl_TessLevelInner[2]; gl_MaxCombinedImageUnitsAndFragmentOutputs = 8;
in int gl_ViewportIndex; const int gl_MaxTessEvaluationAtomicCounterBuffers = 0;
const int gl_MaxImageSamples = 0; const int gl_MaxGeometryAtomicCounterBuffers = 0;
Tessellation Evaluation Language in bool gl_HelperInvocation;
const int gl_MaxVertexImageUniforms= 0; const int gl_MaxFragmentAtomicCounterBuffers = 1;
in gl_PerVertex {
Outputs
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; Derived variables const int gl_MaxGeometryUniformComponents = 1024; const int gl_MaxComputeImageUniforms = 8;
float gl_ClipDistance[]; in uvec3 gl_GlobalInvocationID; const int gl_MaxGeometryVaryingComponents = 64;
float gl_CullDistance[]; in uint gl_LocalInvocationIndex; const int gl_MaxCombinedImageUniforms = 48;
}; const int gl_MaxTessControlInputComponents = 128; const int gl_MaxCombinedShaderOutputResources = 16;
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.