Opengl44 Quick Reference Card
Opengl44 Quick Reference Card
0713
OpenGL 4.4 API Reference Card Page 1
OpenGL Operaton
Floatng-Point Numbers [2.3.3]
16-Bit
1-bit sign, 5-bit exponent,
10-bit mantssa
Unsigned 11-Bit
no sign bit, 5-bit exponent,
6-bit mantssa
Unsigned 10-Bit
no sign bit, 5-bit exponent,
5-bit mantssa
Command Leters [Tables 2.1, 2.2]
Where a leter from the table below is used to
denote type in a functon name, T within the
prototype is the same type.
b - byte (8 bits) ub - ubyte (8 bits)
s - short (16 bits) us - ushort (16 bits)
i - int (32 bits) ui - uint (32 bits)
i64 - int64 (64 bits) ui64 - uint64 (64 bits)
f - foat (32 bits) d - double (64 bits)
OpenGL
Framebufer Objects
Binding and Managing [9.2]
void BindFramebufer(enum target,
uint framebufer);
target: [DRAW_, READ_]FRAMEBUFFER
void GenFramebufers(sizei n,
uint *framebufers);
void DeleteFramebufers(sizei n,
const uint *framebufers);
boolean IsFramebufer(uint framebufer);
Framebufer Object Parameters [9.2.1]
void FramebuferParameteri(
enum target, enum pname, int param);
target: [DRAW_, READ_]FRAMEBUFFER
pname: FRAMEBUFFER_DEFAULT_X where X may be
WIDTH, HEIGHT, FIXED_SAMPLE_LOCATIONS,
SAMPLES, LAYERS
Framebufer Object Queries [9.2.3]
void GetFramebuferParameteriv(
enum target, enum pname, int *params);
target, pname: see FramebuferParameteri
void GetFramebuferAtachmentParameteriv(
enum target, enum atachment,
enum pname, int *params);
target: [DRAW_, READ_]FRAMEBUFFER
atachment: DEPTH, FRONT_{LEFT, RIGHT}, STENCIL,
BACK_{LEFT, RIGHT}, COLOR_ATTACHMENTi,
{DEPTH, STENCIL, DEPTH_STENCIL}_ATTACHMENT
pname: FRAMEBUFFER_ATTACHMENT_ X where X
may be OBJECT_{TYPE, NAME},
COMPONENT_TYPE, {RED, GREEN, BLUE}_SIZE,
{ALPHA, DEPTH, STENCIL}_SIZE,
COLOR_ENCODING, TEXTURE_{LAYER, LEVEL},
LAYERED, TEXTURE_CUBE_MAP_FACE
Ataching Images [9.2.4]
void BindRenderbufer(enum target,
uint renderbufer);
target: RENDERBUFFER
void GenRenderbufers(sizei n,
uint *renderbufers);
void DeleteRenderbufers(sizei n,
const uint *renderbufers);
boolean IsRenderbufer(uint renderbufer);
void RenderbuferStorageMultsample(
enum target, sizei samples,
enum internalformat, sizei width,
sizei height);
target: RENDERBUFFER
internalformat: see TexImage3DMultsample
void RenderbuferStorage(enum target,
enum internalformat, sizei width,
sizei height);
target: RENDERBUFFER
internalformat: see TexImage3DMultsample
Renderbufer Object Queries [9.2.6]
void GetRenderbuferParameteriv(
enum target, enum pname, int *params);
target: RENDERBUFFER
pname: [Table 23.27]
RENDERBUFFER_X where X may be WIDTH,
HEIGHT, INTERNAL_FORMAT, SAMPLES,
{RED, GREEN, BLUE, ALPHA, DEPTH, STENCIL}_SIZE
Ataching Renderbufer Images [9.2.7]
void FramebuferRenderbufer(
enum target, enum atachment,
enum renderbufertarget,
uint renderbufer);
target: [DRAW_, READ_]FRAMEBUFFER
atachment: [Table 9.2]
{DEPTH, STENCIL, DEPTH_STENCIL}_ATTACHMENT,
COLOR_ATTACHMENTi where i is
[0, MAX_COLOR_ATTACHMENTS - 1]
renderbufertarget: RENDERBUFFER
Ataching Texture Images [9.2.8]
void FramebuferTexture(enum target,
enum atachment, uint texture, int level);
target: [DRAW_, READ_]FRAMEBUFFER
atachment: see FramebuferRenderbufer
void FramebuferTexture1D(enum target,
enum atachment, enum textarget,
uint texture, int level);
textarget: TEXTURE_1D
target, atachment: see FramebuferRenderbufer
void FramebuferTexture2D(enum target,
enum atachment, enum textarget,
uint texture, int level);
textarget: TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z},
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
TEXTURE_{2D, RECTANGLE, 2D_MULTISAMPLE}
target, atachment: see FramebuferRenderbufer
void FramebuferTexture3D(enum target,
enum atachment, enum textarget,
uint texture, int level, int layer);
textarget: TEXTURE_3D
target, atachment: see FramebuferRenderbufer
void FramebuferTextureLayer(enum target,
enum atachment, uint texture,
int level, int layer);
target, atachment: see FramebuferRenderbufer
Framebufer Completeness [9.4.2]
enum CheckFramebuferStatus(enum target);
target: [DRAW_, READ_]FRAMEBUFFER
returns: FRAMEBUFFER_COMPLETE or a constant
indicatng the violatng value
Textures and Samplers (cont.)
void CopyTexSubImage1D(enum target,
int level, int xofset, int x, int y, sizei width);
target: see TexSubImage1D
Compressed Texture Images [8.7]
void CompressedTexImage3D(enum target,
int level, enum internalformat, sizei width,
sizei height, sizei depth, int border,
sizei imageSize, const void *data);
target: see TexImage3D
internalformat: COMPRESSED_X where X may be
[SIGNED_]RED_RGTC1, [SIGNED_]RG_RGTC2,
{RGBA, SRGB_ALPHA}_BPTC_UNORM,
RGB_BPTC_{SIGNED, UNSIGNED}_FLOAT
void CompressedTexImage2D(enum target,
int level, enum internalformat,
sizei width, sizei height, int border,
sizei imageSize, const void *data);
target: see TexImage2D, omitng compressed
rectangular texture formats
internalformat: see CompressedTexImage3D,
plus COMPRESSED_X where X may be
{RGB8, SRGB8}_ETC2,
{RGB8, SRGB8}_PUNCHTHROUGH_ALPHA1_ETC2,
{RGBA8, SRGB8_ALPHA8}_ETC2_EAC,
[SIGNED_]R11_EAC, [SIGNED_]RG11_EAC
void CompressedTexImage1D(enum target,
int level, enum internalformat,
sizei width, int border, sizei imageSize,
const void *data);
target: TEXTURE_1D, PROXY_TEXTURE_1D
void CompressedTexSubImage3D(
enum target, int level, int xofset,
int yofset, int zofset, sizei width,
sizei height, sizei depth, enum format,
sizei imageSize, const void *data);
target: see TexSubImage3D
format: see internalformat for
CompressedTexImage3D
void CompressedTexSubImage2D(
enum target, int level, int xofset,
int yofset, sizei width, sizei height,
enum format, sizei imageSize,
cont void *data);
target: see TexSubImage2D
format: see internalformat for
CompressedTexImage2D
void CompressedTexSubImage1D(
enum target, int level, int xofset,
sizei width, enum format, sizei imageSize,
const void *data);
target: see TexSubImage1D
format: see internalformat for
CompressedTexImage1D
Multsample Textures [8.8]
void TexImage3DMultsample(enum target,
sizei samples, int internalformat,
sizei width, sizei height, sizei depth,
boolean fxedsamplelocatons);
target: [PROXY_]TEXTURE_2D_MULTISAMPLE_ARRAY
internalformat: RED, RG, RGB, RGBA,
STENCIL_INDEX, DEPTH_{COMPONENT, STENCIL},
or sized internal formats corresponding to these
base formats
void TexImage2DMultsample(enum target,
sizei samples, int internalformat,
sizei width, sizei height,
boolean fxedsamplelocatons);
target: [PROXY_]TEXTURE_2D_MULTISAMPLE
internalformat: see TexImage3DMultsample
Bufer Textures [8.9]
void TexBuferRange(enum target,
enum internalFormat, uint bufer,
intptr ofset, sizeiptr size);
void TexBufer(enum target,
enum internalformat, uint bufer);
target: TEXTURE_BUFFER
internalformat: [Table 8.15] R8, R8{I, UI}, R16,
R16{F, I, UI}, R32{F, I, UI}, RG8, RG8{I, UI}, RG16,
RG16{F, I, UI}, RG32{F, I, UI}, RGB32F, RGB32{I, UI},
RGBA8, RGBA8{I, UI}, RGBA16, RGBA16{F, I, UI},
RGBA32{F, I, UI}
Texture Parameters [8.10]
void TexParameter{i f}(enum target,
enum pname, T param);
target: see BindTexture
void TexParameter{i f}v(enum target,
enum pname, const T *params);
target: see BindTexture
void TexParameterI{i ui}v(enum target,
enum pname, const T *params);
target: see BindTexture
pname: DEPTH_STENCIL_TEXTURE_MODE or
TEXTURE_X where X may be one of
WRAP_{S, T, R}, BORDER_COLOR,
{MIN, MAG}_FILTER, LOD_BIAS,{MIN, MAX}_LOD,
{BASE, MAX}_LEVEL, SWIZZLE_{R, G, B, A, RGBA},
COMPARE_{MODE, FUNC} [Table 8.16]
Enumerated Queries [8.11]
void GetTexParameter{if}v(enum target,
enum value, T data);
target: see BindTexture
value: see GetTexParameterI
void GetTexParameterI{i ui}v(enum target,
enum value, T data);
target: see BindTexture
value: see pname for TexParameterI{i ui}v,
plus IMAGE_FORMAT_COMPATIBILITY_TYPE,
TEXTURE_IMMUTABLE_{FORMAT, LEVELS},
TEXTURE_VIEW_NUM_{LEVELS, LAYERS},
TEXTURE_VIEW_MIN_{LEVEL, LAYER} [Table 8.16]
void GetTexLevelParameter{i f}v(enum target,
int lod, enum value, T data);
target: [PROXY_]TEXTURE_{1D, 2D, 3D},
TEXTURE_BUFFER, PROXY_TEXTURE_CUBE_MAP,
[PROXY_]TEXTURE_{1D, 2D,CUBE_MAP}_ARRAY,
[PROXY_]TEXTURE_RECTANGLE,
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z},
[PROXY_]TEXTURE_2D_MULTISAMPLE[_ARRAY]
value: TEXTURE_{WIDTH, HEIGHT, DEPTH},
TEXTURE_{SAMPLES, FIXED_SAMPLE_LOCATIONS},
TEXTURE_{INTERNAL_FORMAT, SHARED_SIZE},
TEXTURE_COMPRESSED[_IMAGE_SIZE],
TEXTURE_BUFFER_DATA_STORE_BINDING,
TEXTURE_BUFFER_{OFFSET, SIZE},
TEXTURE_STENCIL_SIZE, TEXTURE_ X_{SIZE, TYPE}
where X can be RED, GREEN, BLUE, ALPHA, DEPTH
void GetTexImage(enum tex, int lod,
enum format, enum type, void *img);
tex: TEXTURE_{1, 2}D[_ARRAY],
TEXTURE_{3D, RECTANGLE, CUBE_MAP_ARRAY},
TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z},
TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z}
format: see ClearBuferSubData, pg 1 this card
type: [UNSIGNED_]BYTE, SHORT, INT,
[HALF_]FLOAT, or a value from [Table 8.2]
void GetCompressedTexImage(enum target,
int lod, void *img);
target: see tex for GetTexImage
Cube Map Texture Select [8.13.1]
Enable/Disable/IsEnabled(
TEXTURE_CUBE_MAP_SEAMLESS);
Manual Mipmap Generaton [8.14.4]
void GenerateMipmap(enum target);
target: TEXTURE_{1D, 2D, 3D},
TEXTURE_{1D, 2D}_ARRAY,
TEXTURE_CUBE_MAP[_ARRAY]
Texture Views [8.18]
void TextureView(uint texture, enum target,
uint origtexture, enum internalformat,
uint minlevel, uint numlevels,
uint minlayer, uint numlayers);
target: TEXTURE_{1D, 2D,CUBE_MAP}[_ARRAY],
TEXTURE_3D, TEXTURE_RECTANGLE,
TEXTURE_2D_MULTISAMPLE[_ARRAY]
internalformat: [Table 8.21] R8{UI, I}, R8[_SNORM],
RG8{F, UI, I}, RG8[_SNORM], RGB8[_SNORM],
RGBA8{UI, I}, RGBA8[_SNORM], SRGB8[UI, I],
SRGB8_ALPHA8, RGB9_E5, RGB10_A2[UI],
R11F_G11F_B10F, RGBA16{F, UI, I},
RGBA16[_SNORM], RGB16{F, UI, I},
RGB16[_SNORM], RG16{F, UI, I}, RG16[_SNORM],
R16{F, UI, I}, R16[_SNORM], RGBA32{F, UI, I},
RGB32{F, UI, I} , RG32{F, UI, I}, R32{F, UI, I};
COMPRESSED_X where X may be
[SIGNED]_RED_RGTC1, [SIGNED]_RG_RGTC2,
{RGBA, SRGB_ALPHA}_BPTC_UNORM,
RGB_BPTC_[UN]SIGNED_FLOAT
Immutable-Format Tex. Images [8.19]
void TexStorage1D(enum target, sizei levels,
enum internalformat, sizei width);
target: TEXTURE_1D, PROXY_TEXTURE_1D
internalformat: any of the sized internal color, depth,
and stencil formats in [Tables 8.18-20]
void TexStorage2D(enum target,
sizei levels, enum internalformat,
sizei width, sizei height);
target: [PROXY_]TEXTURE_{RECTANGLE, CUBE_MAP},
[PROXY_]TEXTURE_{1D_ARRAY, 2D}
internalformat: see TexStorage1D
void TexStorage3D(enum target,
sizei levels, enum internalformat,
sizei width, sizei height, sizei depth);
target: TEXTURE_3D, PROXY_TEXTURE_3D,
[PROXY_]TEXTURE_{CUBE_MAP, 2D}[_ARRAY]
internalformat: see TexStorage1D
void TexStorage2DMultsample(
enum target, sizei samples,
enum internalformat, sizei width,
sizei height, boolean fxedsamplelocatons);
target: [PROXY_]TEXTURE_2D_MULTISAMPLE
void TexStorage3DMultsample(
enum target, sizei samples,
enum internalformat, sizei width,
sizei height, sizei depth,
boolean fxedsamplelocatons);
target: [PROXY_]TEXTURE_2D_MULTISAMPLE_ARRAY
Invalidate Texture Image Data [8.20]
void InvalidateTexSubImage(uint texture,
int level, int xofset, int yofset, int zofset,
sizei width, sizei height, sizei depth);
void InvalidateTexImage(uint texture,
int level);
Clear Texture Image Data [8.21]
void ClearTexSubImage(uint texture,
int level, int xofset, int yofset, int zofset,
sizei width, sizei height, sizei depth,
enum format, enum type,
const void *data);
format, type: see TexImage3D, pg 2 this card
void ClearTexImage(uint texture, int level,
enum format, enum type,
const void *data);
format, type: see TexImage3D, pg 2 this card
Texture Image Loads/Stores [8.26]
void BindImageTexture(uint index,
uint texture, int level, boolean layered,
int layer, enum access, enum format);
access: READ_ONLY, WRITE_ONLY, READ_WRITE
format: RGBA{32,16}F, RG{32,16}F, R11F_G11F_B10F,
R{32,16}F, RGBA{32,16,8}UI, RGB10_A2UI,
RG{32,16,8}UI, R{32,16,8}UI, RGBA{32,16,8}I,
RG{32,16,8}I, R{32,16,8}I, RGBA{16,8}, RGB10_A2,
RG{16,8}, R{16,8}, RGBA{16,8}_SNORM,
RG{16,8}_SNORM, R{16,8}_SNORM [Table 8.25]
void BindImageTextures(uint frst,
sizei count, const uint *textures);
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 4 OpenGL 4.4 API Reference Card
Whole Framebufer
Selectng a Bufer for Writng [17.4.1]
void DrawBufer(enum buf);
buf: [Tables 17.4-5] NONE,
{FRONT, BACK}_{LEFT, RIGHT}, FRONT, BACK,
LEFT, RIGHT, FRONT_AND_BACK,
COLOR_ATTACHMENTi (i = [0,
MAX_COLOR_ATTACHMENTS - 1 ])
void DrawBufers(sizei n, const enum *bufs);
bufs: [Tables 17.5-6] {FRONT, BACK}_{LEFT, RIGHT},
NONE, COLOR_ATTACHMENTi (i = [0,
MAX_COLOR_ATTACHMENTS - 1 ])
Fine Control of Bufer Updates [17.4.2]
void ColorMask(boolean r, boolean g,
boolean b, boolean a);
void ColorMaski(uint buf, boolean r,
boolean g, boolean b, boolean a);
void DepthMask(boolean mask);
void StencilMask(uint mask);
void StencilMaskSeparate(enum face,
uint mask);
face: FRONT, BACK, FRONT_AND_BACK
Clearing the Bufers [17.4.3]
void Clear(bitield buf);
buf: 0 or the OR of
{COLOR, DEPTH, STENCIL}_BUFFER_BIT
void ClearColor(foat r, foat g, foat b, foat a);
void ClearDepth(double d);
void ClearDepthf(foat d);
void ClearStencil(int s);
void ClearBufer{i f ui}v(enum bufer,
int drawbufer, const T *value);
bufer: COLOR, DEPTH, STENCIL
void ClearBuferf(enum bufer,
int drawbufer, foat depth, int stencil);
bufer: DEPTH_STENCIL
drawbufer: 0
Invalidatng Framebufers [17.4.4]
void InvalidateSubFramebufer(
enum target, sizei numAtachments,
const enum *atachments, int x, int y,
sizei width, sizei height);
target: [DRAW_ , READ_]FRAMEBUFFER
atachments: COLOR_ATTACHMENTi, DEPTH,
{DEPTH, STENCIL}_ATTACHMENT,
DEPTH_STENCIL_ATTACHMENT, COLOR,
{FRONT, BACK}_{LEFT, RIGHT}, STENCIL
void InvalidateFramebufer(
enum target, sizei numAtachments,
const enum *atachments);
target, atachment: see InvalidateSubFramebufer
Reading and Copying Pixels
Reading Pixels [18.2]
void ReadPixels(int x, int y, sizei width,
sizei height, enum format, enum type,
void *data);
format: STENCIL_INDEX, RED, GREEN, BLUE, RG, RGB,
RGBA, BGR, DEPTH_{COMPONENT, STENCIL},
{RED, GREEN, BLUE, RG, RGB}_INTEGER,
{RGBA, BGR, BGRA}_INTEGER, BGRA [Table 8.3]
type: [HALF_]FLOAT, [UNSIGNED_]BYTE,
[UNSIGNED_]SHORT, [UNSIGNED_]INT,
FLOAT_32_UNSIGNED_INT_24_8_REV,
UNSIGNED_{BYTE, SHORT, INT}_* values in
[Table 8.2]
void ReadBufer(enum src);
src: NONE, {FRONT, BACK}_{LEFT, RIGHT}, FRONT,
BACK, LEFT, RIGHT, FRONT_AND_BACK,
COLOR_ATTACHMENTi (i =
[0, MAX_COLOR_ATTACHMENTS - 1 ])
Final Conversion [18.2.6]
void ClampColor(enum target, enum clamp);
target: CLAMP_READ_COLOR
clamp: TRUE, FALSE, FIXED_ONLY
Copying Pixels [18.3]
void BlitFramebufer(int srcX0, int srcY0,
int srcX1, int srcY1, int dstX0, int dstY0,
int dstX1, int dstY1, bitield mask,
enum flter);
mask: Bitwise OR of
{COLOR, DEPTH, STENCIL}_BUFFER_BIT or 0
flter: LINEAR, NEAREST
void CopyImageSubData(uint srcName,
enum srcTarget, int srcLevel, int srcX,
int srcY, int srcZ, uint dstName,
enum dstTarget, int dstLevel, int dstX,
int dstY, int dstZ, sizei srcWidth,
sizei srcHeight, sizei srcDepth);
srcTarget, dstTarget: see target for BindTexture in
secton [8.1] on this card, plus GL_RENDERTARGET
Compute Shaders [19]
void DispatchCompute(
uint num_groups_x,
uint num_groups_y,
uint num_groups_z);
void DispatchComputeIndirect(
intptr indirect);
Fragment Shaders [15.2]
void BindFragDataLocatonIndexed(
uint program, uint colorNumber,
uint index, const char *name);
void BindFragDataLocaton(uint program,
uint colorNumber, const char *name);
int GetFragDataLocaton(uint program,
const char *name);
int GetFragDataIndex(uint program,
const char *name);
Per-Fragment Operatons
Scissor Test [17.3.2]
Enable/Disable/IsEnabled(SCISSOR_TEST);
Enablei/Disablei/IsEnabledi(SCISSOR_TEST,
uint index);
void ScissorArrayv(uint frst, sizei count,
const int *v);
void ScissorIndexed(uint index, int lef,
int botom, sizei width, sizei height);
void ScissorIndexedv(uint index, int *v);
void Scissor(int lef, int botom, sizei width,
sizei height);
Multsample Fragment Ops. [17.3.3]
Enable/Disable/IsEnabled(target);
target: SAMPLE_ALPHA_TO_{COVERAGE, ONE},
SAMPLE_COVERAGE, SAMPLE_MASK
void SampleCoverage(foat value,
boolean invert);
void SampleMaski(uint maskNumber,
bitield mask);
Stencil Test [17.3.5]
Enable/Disable/IsEnabled(STENCIL_TEST);
void StencilFunc(enum func, int ref,
uint mask);
func: NEVER, ALWAYS, LESS, GREATER, EQUAL,
LEQUAL, GEQUAL, NOTEQUAL
void StencilFuncSeparate(enum face,
enum func, int ref, uint mask);
func: see StencilFunc
void StencilOp(enum sfail, enum dpfail,
enum dppass);
void StencilOpSeparate(enum face,
enum sfail, enum dpfail, enum dppass);
face: FRONT, BACK, FRONT_AND_BACK
sfail, dpfail, dppass: KEEP, ZERO, REPLACE, INCR,
DECR, INVERT, INCR_WRAP, DECR_WRAP
Depth Bufer Test [17.3.6]
Enable/Disable/IsEnabled(DEPTH_TEST);
void DepthFunc(enum func);
func: see StencilFunc
Occlusion Queries [17.3.7]
BeginQuery(enum target, uint id);
EndQuery(enum target);
target: SAMPLES_PASSED, ANY_SAMPLES_
PASSED, ANY_SAMPLES_PASSED_
CONSERVATIVE
Blending [17.3.8]
Enable/Disable/IsEnabled(BLEND);
Enablei/Disablei/IsEnabledi(BLEND,
uint index);
void BlendEquaton(enum mode);
void BlendEquatonSeparate(enum
modeRGB, enum modeAlpha);
mode, modeRGB, modeAlpha: MIN, MAX ,
FUNC_{ADD, SUBTRACT, REVERSE_SUBTRACT}
void BlendEquatoni(uint buf, enum
mode);
void BlendEquatonSeparatei(uint buf,
enum modeRGB, enum modeAlpha);
mode, modeRGB, modeAlpha:
see BlendEquatonSeparate
void BlendFunc(enum src, enum dst);
src, dst: see BlendFuncSeparate
void BlendFuncSeparate(enum srcRGB,
enum dstRGB, enum srcAlpha,
enum dstAlpha);
src, dst, srcRGB, dstRGB, srcAlpha, dstAlpha:
ZERO, ONE, SRC_ALPHA_SATURATE,
{SRC, SRC1, DST, CONSTANT}_{COLOR, ALPHA},
ONE_MINUS_{SRC, SRC1}_{COLOR, ALPHA},
ONE_MINUS_{DST, CONSTANT}_{COLOR, ALPHA}
void BlendFunci(uint buf, enum src,
enum dst);
src, dst: see BlendFuncSeparate
void BlendFuncSeparatei(uint buf,
enum srcRGB, enum dstRGB,
enum srcAlpha, enum dstAlpha);
dstRGB, dstAlpha, srcRGB, srcAlpha:
see BlendFuncSeparate
void BlendColor(foat red, foat green, foat
blue, foat alpha);
Dithering [17.3.10]
Enable/Disable/IsEnabled(DITHER);
Logical Operaton [17.3.11]
Enable/Disable/IsEnabled(COLOR_LOGIC_OP);
void LogicOp(enum op);
op: CLEAR, AND, AND_REVERSE, COPY,
AND_INVERTED, NOOP, XOR, OR, NOR,
EQUIV, INVERT, OR_REVERSE, COPY_INVERTED,
OR_INVERTED, NAND, SET
Rasterizaton (cont.)
void CullFace(enum mode);
mode: FRONT, BACK, FRONT_AND_BACK
Polygon Rast. & Depth Ofset [14.6.4-5]
void PolygonMode(enum face, enum
mode);
face: FRONT_AND_BACK
mode: POINT, LINE, FILL
void PolygonOfset(foat factor, foat units);
Enable/Disable/IsEnabled(target);
target: POLYGON_OFFSET_{POINT, LINE, FILL}
Debug Output [20]
Enable/Disable/IsEnabled(
DEBUG_OUTPUT);
Debug Message Callback [20.2]
void DebugMessageCallback(
DEBUGPROC callback, void *userParam);
callback: has the prototype:
void callback(enum source, enum type,
uint id, enum severity, sizei length,
const char *message, void *userParam);
source: DEBUG_SOURCE_X where X may be API,
SHADER_COMPILER, WINDOW_SYSTEM,
THIRD_PARTY, APPLICATION, OTHER
type: DEBUG_TYPE_X where X may be ERROR,
MARKER, OTHER, DEPRECATED_BEHAVIOR,
UNDEFINED_BEHAVIOR, PERFORMANCE,
PORTABILITY, {PUSH, POP}_GROUP
severity: DEBUG_SEVERITY_{HIGH, MEDIUM},
DEBUG_SEVERITY_{LOW, NOTIFICATION}
Controlling Debug Messages [20.4]
void DebugMessageControl(enum source,
enum type, enum severity, sizei count,
const uint *ids, boolean enabled);
source, type, severity: see callback (above),
plus DONT_CARE
Externally Generated Messages [20.5]
void DebugMessageInsert(enum source,
enum type, uint id, enum severity,
int length, const char *buf);
source: DEBUG_SOURCE_{APPLICATION, THIRD_PARTY}
type, severity: see DebugMessageCallback
Debug Groups [20.6]
void PushDebugGroup(enum source,
uint id, sizei length, const char *message);
source: see DebugMessageInsert
void PopDebugGroup(void);
Debug Labels [20.7]
void ObjectLabel(enum identfer,
uint name, sizei length, const char *label);
identfer: BUFFER, FRAMEBUFFER,
RENDERBUFFER, PROGRAM_PIPELINE,
PROGRAM, QUERY, SAMPLER, SHADER,
TEXTURE, TRANSFORM_FEEDBACK,
VERTEX_ARRAY
void ObjectPtrLabel(void* ptr, sizei length,
const char *label);
Synchronous Debug Output [20.8]
Enable/Disable/IsEnabled(
DEBUG_OUTPUT_SYNCHRONOUS);
Debug Output Queries [20.9]
uint GetDebugMessageLog(uint count,
sizei bufSize, enum *sources,
enum *types, uint *ids,
enum *severites, sizei *lengths,
char *messageLog);
void GetObjectLabel(enum identfer,
uint name, sizei bufSize, sizei *length,
char *label);
void GetObjectPtrLabel(void* ptr,
sizei bufSize, sizei *length, char *label);
Hints [21.5]
void Hint(enum target, enum hint);
target: FRAGMENT_SHADER_DERIVATIVE_HINT,
TEXTURE_COMPRESSION_HINT,
{LINE, POLYGON}_SMOOTH_HINT
hint: FASTEST, NICEST, DONT_CARE
State and State Requests
A complete list of symbolic constants for states is
shown in the tables in [23].
Simple Queries [22.1]
void GetBooleanv(enum pname,
boolean *data);
void GetIntegerv(enum pname, int *data);
void GetInteger64v(enum pname,
int64 *data);
void GetFloatv(enum pname, foat *data);
void GetDoublev(enum pname,
double *data);
void GetDoublei_v(enum target, uint index,
double *data);
void GetBooleani_v(enum target,
uint index, boolean *data);
void GetIntegeri_v(enum target, uint index,
int *data);
void GetFloat_v(enum target, uint index,
foat *data);
(Contnued on next page >)
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 6 OpenGL 4.4 API Reference Card
States (cont.)
void GetInteger64i_v(enum target,
uint index, int64 *data);
boolean IsEnabled(enum cap);
boolean IsEnabledi(enum target, uint index);
String Queries [22.2]
void GetPointerv(enum pname,
void **params);
ubyte *GetString(enum name);
name: RENDERER, VENDOR, VERSION,
SHADING_LANGUAGE_VERSION
ubyte *GetStringi(enum name, uint index);
name: EXTENSIONS, SHADING_LANGUAGE_VERSION
index: EXTENSIONS range = [0, NUM_EXTENSIONS - 1]
SHADING_LANGUAGE_VERSION range = [0, NUM_
SHADING_LANGUAGE_VERSIONS-1]
Internal Format Queries [22.3]
void GetInternalformat64v(enum target,
enum internalformat, enum pname,
sizei bufSize, int64 *params);
target: [Table 22.2]
TEXTURE_{1D, 2D, 3D, CUBE_MAP}[_ARRAY],
TEXTURE_2D_MULTISAMPLE[_ARRAY],
TEXTURE_{BUFFER, RECTANGLE}, RENDERBUFFER
internalformat: any value
pname:
CLEAR_{BUFFER, TEXTURE}, COLOR_ENCODING,
COLOR_{COMPONENTS, RENDERABLE},
COMPUTE_TEXTURE,
DEPTH_{COMPONENTS, RENDERABLE},
FILTER, FRAMEBUFFER_BLEND,
FRAMEBUFFER_RENDERABLE[_LAYERED],
{FRAGMENT, GEOMETRY}_TEXTURE,
[MANUAL_GENERATE_]MIPMAP,
IMAGE_COMPATIBILITY_CLASS,
IMAGE_PIXEL_{FORMAT, TYPE},
IMAGE_FORMAT_COMPATIBILITY_TYPE,
IMAGE_TEXEL_SIZE,
INTERNALFORMAT_{PREFERRED, SUPPORTED},
INTERNALFORMAT_{RED, GREEN, BLUE}_SIZE,
INTERNALFORMAT_{DEPTH, STENCIL}_SIZE,
INTERNALFORMAT_{ALPHA, SHARED}_SIZE,
INTERNALFORMAT_{RED, GREEN}_TYPE,
INTERNALFORMAT_{BLUE, ALPHA}_TYPE,
INTERNALFORMAT_{DEPTH, STENCIL}_TYPE,
MAX_COMBINED_DIMENSIONS,
MAX_{WIDTH, HEIGHT, DEPTH, LAYERS},
NUM_SAMPLE_COUNTS,
READ_PIXELS[_FORMAT, _TYPE],
SAMPLES, SHADER_IMAGE_ATOMIC,
SHADER_IMAGE_{LOAD, STORE},
SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST,
SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE,
SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST,
SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE,
SRGB_{READ, WRITE},
STENCIL_COMPONENTS,
STENCIL_RENDERABLE,
TESS_CONTROL_TEXTURE,
TESS_EVALUATION_TEXTURE,
TEXTURE_COMPRESSED,
TEXTURE_COMPRESSED_BLOCK_HEIGHT,
TEXTURE_COMPRESSED_BLOCK_WIDTH,
TEXTURE_COMPRESSED_BLOCK_SIZE,
TEXTURE_GATHER[_SHADOW],
[GET_]TEXTURE_IMAGE_FORMAT,
[GET_]TEXTURE_IMAGE_TYPE,
TEXTURE_SHADOW,
TEXTURE_VIEW,
VERTEX_TEXTURE,
VIEW_COMPATIBILITY_CLASS
void GetInternalformatv(enum target,
enum internalformat, enum pname,
sizei bufSize, int *params);
target, pname, internalformat:
see GetInternalformat64v,
OpenGL Texture Views and Texture Object State
T
Texture state set with TextureView()
enum internalformat // base internal format enum target // texture target
uint minlevel // frst level of mipmap uint numlevels // number of mipmap levels
uint minlayer // frst layer of array texture uint numlayers // number of layers in array
Texture View Parameters (immutable)
<target>
TEXTURE_INTERNAL_FORMAT TEXTURE_SHARED_SIZE
TEXTURE_VIEW_{MIN,NUM}_LEVEL TEXTURE_VIEW_{MIN,NUM}_LAYER
TEXTURE_IMMUTABLE_LEVELS IMAGE_FORMAT_COMPATIBILITY_TYPE
TEXTURE_{RED,GREEN,BLUE,ALPHA,DEPTH}_TYPE
TEXTURE_{RED,GREEN,BLUE,ALPHA,DEPTH,STENCIL}_SIZE
Texture Parameters (immutable)
TEXTURE_WIDTH TEXTURE_HEIGHT
TEXTURE_DEPTH TEXTURE_FIXED_SAMPLE_LOCATIONS
TEXTURE_COMPRESSED TEXTURE_COMPRESSED_IMAGE_SIZE
TEXTURE_IMMUTABLE_FORMAT TEXTURE_SAMPLES
Texture Parameters (mutable)
TEXTURE_SWIZZLE_{R,G,B,A} TEXTURE_MAX_LEVEL
TEXTURE_BASE_LEVEL DEPTH_STENCIL_TEXTURE_MODE
Sampler Parameters (mutable)
TEXTURE_BORDER_COLOR
TEXTURE_COMPARE_{FUNC,MODE}
TEXTURE_LOD_BIAS
TEXTURE_{MAX,MIN}_LOD
TEXTURE_{MAG,MIN}_FILTER
TEXTURE_SRGB_DECODE
TEXTURE_WRAP_{S,T,R}
OpenGL Compute Programming Model and Compute Memory Hierarchy
Use the barrier functon to synchronize invocatons in a work group:
void barrier();
Use the memoryBarrier* or groupMemoryBarrier functons to order
reads/writes accessible to other invocatons:
void memoryBarrier();
void memoryBarrierAtomicCounter();
void memoryBarrierBuffer();
void memoryBarrierImage();
void memoryBarrierShared(); // Only for compute shaders
void groupMemoryBarrier(); // Only for compute shaders
Use the compute shader built-in variables to specify work groups and invocatons:
in vec3 gl_NumWorkGroups; // Number of workgroups dispatched
const vec3 gl_WorkGroupSize; // Size of each work group for current shader
in vec3 gl_WorkGroupID; // Index of current work group being executed
in vec3 gl_LocalInvocationID; // index of current invocation in a work group
in vec3 gl_GlobalInvocationID; // Unique ID across all work groups and threads. (gl_GlobalInvocationID = gl_WorkGroupID * gl_WorkGroupSize + gl_LocalInvocationID)
gl_WorkGroupSize = (4,2,0)
gl_WorkGroupID = (2,0,0)
gl_LocalInvocationID = (1,0,0)
gl_GlobalInvocationID = (9,0,0)
gl_NumWorkGroups = (4,2,0)
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
OpenGL 4.4 API Reference Card Page 7
OpenGL Pipeline
A typical program that uses OpenGL
begins with calls to open a window into
the framebufer into which the program
will draw. Calls are made to allocate a GL
context which is then associated with the
window, then OpenGL commands can be
issued.
The heavy black arrows in this illustraton
show the OpenGL pipeline and indicate
data fow.
Blue blocks indicate various bufers
that feed or get fed by the OpenGL
pipeline.
Green blocks indicate fxed functon
stages.
Yellow blocks indicate programmable
stages.
Texture binding
Bufer binding
T
B
Vertex & Tessellaton Details
Each vertex is processed either by a vertex shader
or fxed-functon vertex processing (compatbility
only) to generate a transformed vertex, then
assembled into primitves. Tessellaton (if enabled)
operates on patch primitves, consistng of a fxed-
size collecton of vertces, each with per-vertex
atributes and associated per-patch atributes.
Tessellaton control shaders (if enabled) transform
an input patch and compute per-vertex and per-
patch atributes for a new output patch.
A fxed-functon primitve generator
subdivides the patch according to
tessellaton levels computed in the
tessellaton control shaders or specifed
as fxed values in the API (TCS disabled).
The tessellaton evaluaton shader
computes the positon and atributes of
each vertex produced by the tessellator.
Orange blocks indicate features of the Core
specifcaton.
Purple blocks indicate features of the
Compatbility specifcaton.
Green blocks indicate features new or
signifcantly changed with OpenGL 4.x.
Geometry & Follow-on Details
Geometry shaders (if enabled) consume
individual primitves built in previous primitve
assembly stages. For each input primitve,
the geometry shader can output zero or more
vertces, with each vertex directed at a specifc
vertex stream. The vertces emited to each
stream are assembled into primitves according
to the geometry shaders output primitve type.
Transform feedback (if actve) writes selected
vertex atributes of the primitves of all vertex
streams into bufer objects atached to one or
more binding points.
Primitves on vertex stream zero are then
processed by fxed-functon stages, where they
are clipped and prepared for rasterizaton.
Orange blocks indicate features of the Core
specifcaton.
Purple blocks indicate features of the
Compatbility specifcaton.
Green blocks indicate features new or
signifcantly changed with OpenGL 4.x.
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 8 OpenGL Shading Language 4.40 Reference Card
Types [4.1]
Transparent Types
void no functon return value
bool Boolean
int, uint signed/unsigned integers
foat single-precision foatng-point
scalar
double double-precision foatng scalar
vec2, vec3, vec4 foatng point vector
dvec2, dvec3, dvec4 double precision foatng-point
vectors
bvec2, bvec3, bvec4 Boolean vectors
ivec2, ivec3, ivec4
uvec2, uvec3, uvec4
signed and unsigned integer
vectors
mat2, mat3, mat4 2x2, 3x3, 4x4 foat matrix
mat2x2, mat2x3,
mat2x4
2-column foat matrix of
2, 3, or 4 rows
mat3x2, mat3x3,
mat3x4
3-column foat matrix of
2, 3, or 4 rows
mat4x2, mat4x3,
mat4x4
4-column foat matrix of
2, 3, or 4 rows
dmat2, dmat3,
dmat4
2x2, 3x3, 4x4 double-precision
foat matrix
dmat2x2, dmat2x3,
dmat2x4
2-col. double-precision foat
matrix of 2, 3, 4 rows
dmat3x2, dmat3x3,
dmat3x4
3-col. double-precision foat
matrix of 2, 3, 4 rows
dmat4x2, dmat4x3,
dmat4x4
4-column double-precision foat
matrix of 2, 3, 4 rows
Floatng-Point Opaque Types
sampler{1D,2D,3D}
image{1D,2D,3D}
1D, 2D, or 3D texture
samplerCube
imageCube
cube mapped texture
sampler2DRect
image2DRect
rectangular texture
sampler{1D,2D}Array
image{1D,2D}Array
1D or 2D array texture
samplerBufer
imageBufer
bufer texture
sampler2DMS
image2DMS
2D mult-sample texture
sampler2DMSArray
image2DMSArray
2D mult-sample array
texture
samplerCubeArray
imageCubeArray
cube map array texture
sampler1DShadow
sampler2DShadow
1D or 2D depth texture
with comparison
sampler2DRectShadow rectangular tex. / compare
sampler1DArrayShadow
sampler2DArrayShadow
1D or 2D array depth
texture with comparison
samplerCubeShadow cube map depth texture
with comparison
samplerCubeArrayShadow cube map array depth
texture with comparison
Signed Integer Opaque Types
isampler[1,2,3]D integer 1D, 2D, or 3D texture
iimage[1,2,3]D integer 1D, 2D, or 3D image
isamplerCube integer cube mapped texture
iimageCube integer cube mapped image
isampler2DRect int. 2D rectangular texture
Contnue
Built-In Functons
Angle & Trig. Functons [8.1]
Functons will not result in a divide-by-zero
error. If the divisor of a rato is 0, then results
will be undefned. Component-wise operaton.
Parameters specifed as angle are in units of
radians. Tf=foat, vecn.
Tf radians(Tf degrees) degrees to radians
Tf degrees(Tf radians) radians to degrees
Tf sin(Tf angle) sine
Tf cos(Tf angle) cosine
Tf tan(Tf angle) tangent
Tf asin(Tf x) arc sine
Tf acos(Tf x) arc cosine
Tf atan(Tf y, Tf x)
Tf atan(Tf y_over_x)
arc tangent
Tf sinh(Tf x) hyperbolic sine
Tf cosh(Tf x) hyperbolic cosine
Tf tanh(Tf x) hyperbolic tangent
Tf asinh(Tf x) hyperbolic sine
Tf acosh(Tf x) hyperbolic cosine
Tf atanh(Tf x) hyperbolic tangent
Exponental Functons [8.2]
Component-wise operaton. Tf=foat, vecn.
Td= double, dvecn. Tfd= Tf, Td
Tf pow(Tf x, Tf y) x
y
Tf exp(Tf x) e
x
Tf log(Tf x) ln
Tf exp2(Tf x) 2
x
Tf log2(Tf x) log
2
Tfd sqrt(Tfd x) square root
Tfd inversesqrt(Tfd x) inverse square root
Common Functons [8.3]
Component-wise operaton. Tf=foat, vecn. Tb=bool,
bvecn. Ti=int, ivecn. Tu=uint, uvecn.
Td= double, dvecn. Tfd= Tf, Td. Tiu= Ti, Tu.
Returns absolute value:
Tfd abs(Tfd x) Ti abs(Ti x)
Returns -1.0, 0.0, or 1.0:
Tfd sign(Tfd x) Ti sign(Ti x)
Returns nearest integer <= x:
Tfd foor(Tfd x)
Returns nearest integer with absolute value <= absolute
value of x:
Tfd trunc(Tfd x)
Returns nearest integer, implementaton-dependent
rounding mode:
Tfd round(Tfd x)
Returns nearest integer, 0.5 rounds to nearest even integer:
Tfd roundEven(Tfd x)
Returns nearest integer >= x:
Tfd ceil(Tfd x)
Returns x - foor(x):
Tfd fract(Tfd x)
Returns modulus:
Tfd mod(Tfd x, Tfd y)
Tf mod(Tf x, foat y)
Td mod(Td x, double y)
Returns separate integer and fractonal parts:
Tfd modf(Tfd x, out Tfd i)
Returns minimum value:
Tfd min(Tfd x, Tfd y)
Tf min(Tf x, foat y)
Td min(Td x, double y)
Tiu min(Tiu x, Tiu y)
Ti min(Ti x, int y)
Tu min(Tu x, uint y)
(Contnue
)
Common Functons (cont.)
Returns maximum value:
Tfd max(Tfd x, Tfd y)
Tf max(Tf x, foat y)
Td max(Td x, double y)
Tiu max(Tiu x, Tiu y)
Ti max(Ti x, int y)
Tu max(Tu x, uint y)
Returns min(max(x, minVal), maxVal):
Tfd clamp(Tfd x, Tfd minVal, Tfd maxVal)
Tf clamp(Tf x, foat minVal, foat maxVal)
Td clamp(Td x, double minVal, double maxVal)
Tiu clamp(Tiu x, Tiu minVal, Tiu maxVal)
Ti clamp(Ti x, int minVal, int maxVal)
Tu clamp(Tu x, uint minVal, uint maxVal)
Returns linear blend of x and y:
Tfd mix(Tfd x, Tfd y, Tfd a)
Tf mix(Tf x, Tf y, foat a)
Td mix(Td x, Td y, double a)
Returns true if components in a select components from
y, else from x:
Tfd mix(Tfd x, Tfd y, Tb a)
Returns 0.0 if x < edge, else 1.0:
Tfd step(Tfd edge, Tfd x)
Tf step(foat edge, Tf x)
Td step(double edge, Td x)
Clamps and smoothes:
Tfd smoothstep(Tfd edge0, Tfd edge1, Tfd x)
Tf smoothstep(foat edge0, foat edge1, Tf x)
Td smoothstep(double edge0, double edge1, Td x)
Returns true if x is NaN:
Tb isnan(Tfd x)
Returns true if x is positve or negatve infnity:
Tb isinf(Tfd x)
Returns signed int or uint value of the encoding of a foat:
Ti foatBitsToInt(Tf value)
Tu foatBitsToUint(Tf value)
Returns foat value of a signed int or uint encoding of a foat:
Tf intBitsToFloat(Ti value) Tf uintBitsToFloat(Tu value)
Computes and returns a*b + c. Treated as a single operaton
when using precise:
Tfd fma(Tfd a, Tfd b, Tfd c)
Splits x into a foatng-point signifcand in the range [0.5, 1.0)
and an integer exponent of 2:
Tfd frexp(Tfd x, out Ti exp)
Builds a foatng-point number from x and the corresponding
integral exponent of 2 in exp:
Tfd ldexp(Tfd x, in Ti exp)
Floatng-Point Pack/Unpack [8.4]
These do not operate component-wise.
Converts each component of v into 8- or 16-bit ints, packs
results into the returned 32-bit unsigned integer:
uint packUnorm2x16(vec2 v)
uint packSnorm2x16(vec2 v)
uint packUnorm4x8(vec4 v)
uint packSnorm4x8(vec4 v)
Unpacks 32-bit p into two 16-bit uints, four 8-bit uints, or
signed ints. Then converts each component to a normalized
foat to generate a 2- or 4-component vector:
vec2 unpackUnorm2x16(uint p)
vec2 unpackSnorm2x16(uint p)
vec4 unpackUnorm4x8(uint p)
vec4 unpackSnorm4x8(uint p)
Packs components of v into a 64-bit value and returns a
double-precision value:
double packDouble2x32(uvec2 v)
Returns a 2-component vector representaton of v:
uvec2 unpackDouble2x32(double v)
Returns a uint by convertng the components of a two-
component foatng-point vector:
uint packHalf2x16(vec2 v)
Returns a two-component foatng-point vector:
vec2 unpackHalf2x16(uint v)
Geometric Functons [8.5]
These functons operate on vectors as vectors, not
component-wise. Tf=foat, vecn. Td =double, dvecn.
Tfd= foat, vecn, double, dvecn.
foat length(Tf x)
double length(Td x)
length of vector
foat distance(Tf p0, Tf p1)
double distance(Td p0, Td p1)
distance between points
foat dot(Tf x, Tf y)
double dot(Td x, Td y)
dot product
vec3 cross(vec3 x, vec3 y)
dvec3 cross(dvec3 x, dvec3 y)
cross product
Tfd normalize(Tfd x) normalize vector to length 1
Tfd faceforward(Tfd N,
Tfd I, Tfd Nref)
returns N if dot(Nref, I) <
0, else -N
Tfd refect(Tfd I, Tfd N) refecton directon
I - 2 * dot(N,I) * N
Tfd refract(Tfd I, Tfd N,
foat eta)
refracton vector
Matrix Functons [8.6]
N and M are 1, 2, 3, 4.
mat matrixCompMult(mat x, mat y)
dmat matrixCompMult(dmat x, dmat y)
component-wise
multply
matN outerProduct(vecN c, vecN r)
dmatN outerProduct(dvecN c, dvecN r)
outer product
(where N != M)
matNxM outerProduct(vecM c, vecN r)
dmatNxM outerProduct(dvecM c, dvecN r)
outer product
matN transpose(matN m)
dmatN transpose(dmatN m)
transpose
matNxM transpose(matMxN m)
dmatNxM transpose(dmatMxN m)
transpose
(where N != M)
foat determinant(matN m)
double determinant(dmatN m)
determinant
matN inverse(matN m)
dmatN inverse(dmatN m)
inverse
Vector Relatonal Functons [8.7]
Compare x and y component-wise. Sizes of the
input and return vectors for any partcular call
must match. Tvec=vecn, uvecn, ivecn.
bvecn lessThan(Tvec x, Tvec y) <
bvecn lessThanEqual(Tvec x, Tvec y) <=
bvecn greaterThan(Tvec x, Tvec y) >
bvecn greaterThanEqual(Tvec x, Tvec y) >=
bvecn equal(Tvec x, Tvec y)
bvecn equal(bvecn x, bvecn y)
==
bvecn notEqual(Tvec x, Tvec y)
bvecn notEqual(bvecn x, bvecn y)
!=
bool any(bvecn x)
true if any component of x is true
bool all(bvecn x) true if all comps. of x are true
bvecn not(bvecn x)
logical complement of x
Integer Functons [8.8]
Component-wise operaton. Tu=uint, uvecn.
Ti=int, ivecn. Tiu=int, ivecn, uint, uvecn.
Adds 32-bit uint x and y, returning the sum modulo 2
32
:
Tu uaddCarry(Tu x, Tu y, out Tu carry)
Subtracts y from x, returning the diference if non-negatve,
otherwise 2
32
plus the diference:
Tu usubBorrow(Tu x, Tu y, out Tu borrow)
(Contnue
)
Integer Functons (cont.)
Multplies 32-bit integers x and y, producing a 64-bit result:
void umulExtended(Tu x, Tu y, out Tu msb, out Tu lsb)
void imulExtended(Ti x, Ti y, out Ti msb, out Ti lsb)
Extracts bits [ofset, ofset + bits - 1] from value, returns
them in the least signifcant bits of the result:
Tiu bitieldExtract(Tiu value, int ofset, int bits)
Returns the reversal of the bits of value:
Tiu bitieldReverse(Tiu value)
Inserts the bits least-signifcant bits of insert into base:
Tiu bitieldInsert(Tiu base, Tiu insert, int ofset, int bits)
Returns the number of bits set to 1:
Ti bitCount(Tiu value)
Returns the bit number of the least signifcant bit:
Ti fndLSB(Tiu value)
Returns the bit number of the most signifcant bit:
Ti fndMSB(Tiu value)
Texture Lookup Functons [8.9]
Available to vertex, geometry, and fragment
shaders. See tables on next page.
Atomic-Counter Functons [8.10]
Returns the value of an atomic counter.
Atomically increments c then returns its prior value:
uint atomicCounterIncrement(atomic_uint c)
Atomically decrements c then returns its prior value:
uint atomicCounterDecrement(atomic_uint c)
Atomically returns the counter for c:
uint atomicCounter(atomic_uint c)
Atomic Memory Functons [8.11]
Operates on individual integers in bufer-object
or shared-variable storage. OP is Add, Min, Max,
And, Or, Xor, Exchange, or CompSwap.
uint atomicOP(inout uint mem, uint data)
int atomicOP(inout int mem, int data)
Image Functons [8.12]
In these image functons, IMAGE_PARAMS may
be one of the following:
gimage1D image, int P
gimage2D image, ivec2 P
gimage3D image, ivec3 P
gimage2DRect image, ivec2 P
gimageCube image, ivec3 P
gimageBufer image, int P
gimage1DArray image, ivec2 P
gimage2DArray image, ivec3 P
gimageCubeArray image, ivec3 P
gimage2DMS image, ivec2 P, int sample
gimage2DMSArray image, ivec3 P, int sample
Returns the dimensions of the images or images:
int imageSize(gimage{1D,Bufer} image)
ivec2 imageSize(gimage{2D,Cube,Rect,1DArray,
2DMS} image)
ivec3 imageSize(gimage{Cube,2D,2DMS}Array image)
vec3 imageSize(gimage3D image)
Loads texel at the coordinate P from the image unit image:
gvec4 imageLoad(readonly IMAGE_PARAMS)
Stores data into the texel at the coordinate P from
the image specifed by image:
void imageStore(writeonly IMAGE_PARAMS, gvec4 data)
(Contnued on next page >)
Type Abbreviatons for Built-in Functons: In vector types, n is 2, 3, or 4.
Tf=foat, vecn. Td =double, dvecn. Tfd= foat, vecn, double, dvecn. Tb= bool, bvecn.
Tu=uint, uvecn. Ti=int, ivecn. Tiu=int, ivecn, uint, uvecn. Tvec=vecn, uvecn, ivecn.
Within any one functon, type sizes and dimensionality must correspond afer implicit type
conversions. For example, foat round(foat) is supported, but foat round(vec4) is not.
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
OpenGL Shading Language 4.40 Reference Card Page 11
)
Image Functons (cont.)
Performs a bit-wise exclusive OR of the value of data and
the contents of the selected texel:
uint imageAtomicXor(IMAGE_PARAMS, uint data)
int imageAtomicXor(IMAGE_PARAMS, int data)
Copies the value of data:
uint imageAtomicExchange(IMAGE_PARAMS, uint data)
int imageAtomicExchange(IMAGE_PARAMS, int data)
Compares the value of compare and contents of selected
texel. If equal, the new value is given by data; otherwise,
it is taken from the original value loaded from texel:
uint imageAtomicCompSwap(IMAGE_PARAMS,
uint compare, uint data)
int imageAtomicCompSwap(IMAGE_PARAMS, int compare,
int data)
Fragment Processing Functons [8.13]
Available only in fragment shaders.
Tf=foat, vecn.
Derivatve fragment-processing functons
Tf dFdx(Tf p) derivatve in x
Tf dFdy(Tf p) derivatve in y
Tf fwidth(Tf p)
sum of absolute derivatve in x and y;
abs(dFdx(p)) + abs(dFdy(p));
Interpolaton fragment-processing functons
Return value of interpolant sampled inside pixel and the
primitve:
Tf interpolateAtCentroid(Tf interpolant)
Return value of interpolant at locaton of sample # sample:
Tf interpolateAtSample(Tf interpolant, int sample)
Return value of interpolant sampled at fxed ofset ofset
from pixel center:
Tf interpolateAtOfset(Tf interpolant, vec2 ofset)
Noise Functons [8.14]
Returns noise value. Available to fragment, geometry,
and vertex shaders. n is 2, 3, or 4:
foat noise1(Tf x) vecn noisen(Tf x)
Geometry Shader Functons [8.15]
Only available in geometry shaders.
Emits values of output variables to current output
primitve stream stream:
void EmitStreamVertex(int stream)
Completes current output primitve stream stream and
starts a new one:
void EndStreamPrimitve(int stream)
(Contnue
)
Geometry Shader Functons (contd)
Emits values of output variables to the current output
primitve:
void EmitVertex()
Completes output primitve and starts a new one:
void EndPrimitve()
Other Shader Functons [8.16-17]
See diagram on page 11 for more informaton.
Synchronizes across shader invocatons:
void barrier()
Controls ordering of memory transactons issued by a
single shader invocaton:
void memoryBarrier()
Controls ordering of memory transactons as viewed by
other invocatons in a compute work group:
void groupMemoryBarrier()
Order reads and writes accessible to other invocatons:
void memoryBarrierAtomicCounter()
void memoryBarrierShared()
void memoryBarrierBufer()
void memoryBarrierImage()
www.opengl.org/registry 2013 Khronos Group - Rev. 0713
Page 12 OpenGL 4.4 API Reference Card
OpenGL is a registered trademark of Silicon Graphics Internatonal, used under license by Khronos Group.
The Khronos Group is an industry consortum creatng open standards for the authoring and acceleraton
of parallel computng, graphics and dynamic media on a wide variety of platorms and devices.
See www.khronos.org to learn more about the Khronos Group.
See www.opengl.org to learn more about OpenGL.
OpenGL API and OpenGL Shading Language Reference Card Index
The following index shows each item included on this card along with the page on which it is described. The color of the row in the table below is the color of the pane to which you should refer.
A
ActveShaderProgram 2
ActveTexture 2
Angle Functons 10
Arrays 7
Asynchronous Queries 1
Atomic Counter Functons 10
Atomic Memory Functons 10
AtachShader 1
B
BeginConditonalRender 4
BeginQuery[Indexed] 1
BeginQuery 5
BeginTransformFeedback 4
BindAtribLocaton 4
BindBufer* 1
BindFramebufer 3
BindFragData* 5
BindImageTexture 3
BindProgramPipeline 2
BindRenderbufer 3
BindSampler 2
BindTexture 2
BindTransformFeedback 4
BindVertex{Bufer, Array} 4
BlendColor 5
BlendEquaton[Separate]* 5
BlendFunc[Separate]* 5
BlitFramebufer 5
Bufer Objects 1
Bufer Textures 2
BuferStorage 1
Bufer[Sub]Data 1
C
Callback 5
CheckFramebuferStatus 3
ClampColor 5
Clear 5
ClearBufer[Sub]Data 1
ClearBufer* 5
ClearColor 5
ClearDepth[f] 5
ClearStencil 5
ClearTex[Sub]Image 3
ClientWaitSync 1
ColorMask[i] 5
Command Leters 1
Common Functons 10
CompileShader 1
CompressedTexImage* 3
CompressedTexSubImage* 3
Compute Programming Diagram 6
Compute Shaders 5
Constants 9
Constructors 9
Conversions 6
CopyBuferSubData 1
CopyImageSubData 5
CopyTexImage* 2
CopyTexSubImage* 2,3
CreateProgram 1
CreateShader[Programv] 1
Cube Map Texture Select 3
CullFace 4
D
DebugMessage* 5
DeleteBufers 1
DeleteFramebufers 3
DeleteProgram 1
DeleteProgramPipelines 2
DeleteQueries 1
DeleteRenderbufers 3
DeleteSamplers 2
DeleteShader 1
DeleteSync 1
DeleteTextures 2
DeleteTransformFeedbacks 4
DeleteVertexArrays 4
DepthFunc 5
DepthMask 5
DepthRange* 4
Derivatve Functons 9
DetachShader 1
DisableVertexAtribArray 4
DispatchCompute* 5
Dithering 5
DrawArrays* 4
DrawBufer 5
DrawElements* 4
DrawRangeElements[BaseVertex] 4
DrawTransformFeedback* 4
E
EnableVertexAtribArray 4
EndconditonalRender 4
EndQuery[Indexed] 1
EndQuery 5
EndTransformFeedback 4
Errors 1
Evaluators 6
Exponental Functons 10
F
FenceSync 1
Finish 1
Flatshading 4
Floatng-point Numbers 1
Floatng-Point Pack/Unpack Func. 10
Flush 1
FlushMappedBuferRange 1
Fragment Operatons 4,5
Fragment Processing Functons 11
Fragment Shaders 5
Framebufer 5
Framebufer Objects 3
FramebuferParameteri 3
FramebuferRenderbufer 3
FramebuferTexture* 3
FrontFace 4
G
GenBufers 1
GenerateMipmap 3
GenFramebufers 3
GenProgramPipelines 2
GenQueries 1
GenRenderbufers 3
GenSamplers 2
GenTextures 2
GenTransformFeedbacks 4
GenVertexArrays 4
Geometric Functons 11
Geometry & Follow-on Diagram 7
GetActveAtomicCounterBufer 2
GetActveAtrib 4
GetActveSubroutne* 2
GetActveUniform* 2
GetAtachedShaders 3
GetAtribLocaton 4
GetBoolean* 5
GetBuferParameter* 1
GetBuferPointerv 1
GetBuferSubData 1
GetCompressedTexImage 3
GetDebugMessageLog 5
GetDouble* 5
GetError 1
GetFloat* 5
GetFragData* 5
GetFramebuferAtachment... 3
GetFramebuferParameteriv 3
GetInteger* 5,6
GetInteger64v 1
GetInternalFormat* 6
GetMultsamplefv 4
GetObject[Ptr]Label 5
GetPointerv 6
GetProgram* 1
GetProgramiv 2
GetProgramBinary 2
GetProgram[Pipeline]InfoLog 2
GetProgram[Pipeline, Stage]iv 2
GetQuery* 1
GetRenderbuferParameteriv 3
GetSamplerParameter* 2
GetShaderiv 2
GetShaderInfoLog 2
GetShaderPrecisionFormat 2
GetShaderSource 2
GetString* 6
GetSubroutneIndex 2
GetSubroutneUniformLocaton 2
GetSynciv 1
GetTexImage 3
GetTex[Level]Parameter* 3
GetTransformFeedbackVarying 4
GetUniform* 2
GetUniform{f d i ui}v 3
GetUniformSubroutneuiv 3
GetVertexAtrib* 4
GL Command Syntax 1
H
Hint 5
I
Image Functons 10,11
Integer Functons 10
Interpolaton Functons 9
Interpolaton Qualifers 9
InvalidateBufer* 1
Invalidate[Sub]Framebufer 5
InvalidateTex[Sub]Image 3
Invariant Qualifers 7
IsBufer 1
IsFramebufer 3
IsProgram 1
IsProgramPipeline 2
IsQuery 1
IsRenderbufer 3
IsSampler 2
IsShader 1
IsSync 1
IsTexture 2
IsTransformFeedback 4
IsVertexArray 4
Iteraton and Jumps 9
L
Layout Qualifers 8
LineWidth 4
LinkProgram 1
LogicOp 5
M
Macros 6
MapBufer[Range] 1
Matrices 2
Matrix Examples 9
Matrix Functons 10
MemoryBarrier 2
MemoryBarrier 9
Memory Qualifers 7
MinSampleShading 4
MultDraw{Arrays, Elements}* 4
MultDrawElementsBaseVertex 4
Multsample Fragment Ops 4
Multsample Textures 2
Multsampling 4
N
Noise Functons 11
O
Object[Ptr]Label 5
Occlusion Queries 5
OpenGL Shading Language 8-11
Operators 8,9
P
Pack/Unpack Functons 8
Parameter Qualifers 9
PatchParameter 4
PauseTransformFeedback 4
Pipeline Diagram 7
PixelStore{if} 2
PointParameter* 4
PointSize 4
Polygon{Mode, Ofset} 5
{Pop, Push}DebugGroup 5
Precise & Precision Qualifers 9
Predefned Macros 8
Preprocessor 8
Primitve Clipping 4
PrimitveRestartIndex 4
Program Objects 2
Program Queries 2
ProgramBinary 2
ProgramParameteri 1
ProgramUniform[Matrix]* 2
ProvokingVertex 4
{Push, Pop}Group 5
Q
Qualifers 8,9
QueryCounter 1
R
Rasterizaton 4
ReadBufer 5
ReadPixels 5
ReleaseShaderCompiler 1
Renderbufer Object Queries 3
RenderbuferStorage[Multsample] 3
ResumeTransformFeedback 4
S
SampleCoverage 5
SampleMaski 5
Sampler Queries 2
SamplerParameter* 2
Scissor[Indexed]* 5
ScissorArrayv 5
Shaders and Programs 1,2
Shader Functons 11
Shader[Binary, Source] 1
ShadersStorageBlockBinding 2
State and State Requests 5
Statements 9
StencilFunc[Separate] 5
StencilMask[Separate] 5
StencilOp[Separate] 5
Storage Qualifers 8
Structures 7
Subroutne Uniform Variables 2
Subroutnes 9
Synchronizaton 1
T
Tessellaton Diagram 7
TexBufer* 3
TexImage* 2
TexImage*Multsample 3
TexStorage{1, 2, 3}D 3
TexSubImage* 2
TexParameter* 3
Texture/Texel Functons 11
Texture Queries 11
TextureView 3
Texture View/State Diagram 6
Texturing 2,3
Timer Queries 1
Transform Feedback 4
TransformFeedbackVaryings 4
Trigonometry Functons 10
Types 8
U
Uniform Qualifers 6
Uniform Variables 2
Uniform* 2
UniformBlockBinding 2
UniformMatrix* 2
UniformSubroutnesuiv 2
UnmapBufer 1
UseProgram 1
UseProgramStages 2
V
ValidateProgram[Pipeline] 4
Variables 9
Vector & Matrix 7
Vector Relatonal Functons 10
Vertex & Tessellaton Diagram 7
Vertex Arrays 4
VertexAtrib* 4
VertexAtrib*Format 4
VertexAtrib*Pointer 4
VertexAtrib[Binding, Divisor] 4
VertexBindingDivisor 4
Viewport* 4
W
WaitSync 1
Reference card producton by Miller & Mattson www.millermatson.com