Sei sulla pagina 1di 8

OpenGL 4.

00 API Quick Reference Card


OpenGL® is the only cross-platform graphics API that enables developers of software for GL Command Syntax [2.3]
PC, workstation, and supercomputing hardware to create high-performance, visually- GL commands are formed from a return type, a name, and optionally up to 4 characters
compelling graphics software applications, in markets such as CAD, content creation, (or character pairs) from the Command Letters table (above), as shown by the prototype below:
energy, entertainment, game development, manufacturing, medical, and virtual reality.
Specifications are available at www.opengl.org/registry return-type Name{1234}{b s i i64 f d ub us ui ui64}{v} ([args ,] T arg1 , . . . , T argN [, args]);
• see FunctionName refers to functions on this reference card.
• Content shown in blue is removed from the OpenGL 4.00 core profile and present only in the The arguments enclosed in brackets ([args ,] and [, args]) may or may not be present.
OpenGL 4.00 compatibility profile. Profile selection is made at context creation. The argument type T and the number N of arguments may be indicated by the command name
• [n.n.n] and [Table n.n] refer to sections and tables in the OpenGL 4.00 core specification. suffixes. N is 1, 2, 3, or 4 if present, or else corresponds to the type letters from the Command
• [n.n.n] and [Table n.n] refer to sections and tables in the OpenGL 4.00 compatibility profile Table (above). If “v” is present, an array of N items are passed by a pointer.
specification, and are shown only when they differ from the core profile. For brevity, the OpenGL documentation and this reference may omit the standard prefixes.
• [n.n.n] refers to sections in the OpenGL Shading Language 4.00 specification. The actual names are of the forms:
glFunctionName(), GL_CONSTANT, GLtype
OpenGL Operation Command Letters [Table 2.1]
Letters are used in commands to denote types.
Floating-Point Numbers [2.1.1 - 2.1.4]
b - byte (8 bits) ub - ubyte (8 bits)
16-Bit 1-bit sign, 5-bit exponent,
10-bit mantissa s - short (16 bits) us - ushort (16 bits)
Vertex Specification void Normal3{bsifd}(T coords);
Begin and End [2.6] void Normal3{bsifd}v(T coords);
Unsigned 11-Bit no sign bit, 5-bit exponent, i - int (32 bits) ui - uint (32 bits)
6-bit mantissa Enclose coordinate sets between Begin/End void NormalP3ui(enum type, uint normal)
Unsigned 10-Bit no sign bit, 5-bit exponent, i64 - int64 (64 bits) ui64 - uint64 (64 bits) pairs to construct geometric objects.
void NormalP3uiv(enum type, uint *normal)
5-bit mantissa f - float (32 bits) d - double (64 bits) void Begin(enum mode);
void End(void); void FogCoord{fd}(T coord);
mode: see MultiDrawElementsBaseVertex void FogCoord{fd}v(T coord);
Vertex Arrays [2.8] void PrimitiveRestartIndex(uint index); Separate Patches void Color{34}{bsifd ubusui}(T components);
Vertex data may be placed into arrays stored in void PatchParameteri(enum pname, int value);
Drawing Commands [2.8.2] [2.8.3] pname: PATCH_VERTICES void Color{34}{bsifd ubusui}v(
the client address space or server address space. void DrawArrays(enum mode, int first, T components);
void VertexPointer(int size, enum type, sizei count); Polygon Edges [2.6.2]
sizei stride, void *pointer); void ColorP{34}ui(enum type, uint coords)
void DrawArraysInstanced(enum mode, Flag each edge of polygon primitives as either
type: SHORT, INT, FLOAT, HALF_FLOAT, DOUBLE,
int first, sizei count, sizei primcount}; boundary or non-boundary. void ColorP{34}uiv(enum type, uint *coords)
INT_2_10_10_10_REV, void EdgeFlag(boolean flag);
UNSIGNED_INT_2_10_10_10_REV void DrawArraysIndirect(enum mode, void SecondaryColor3{bsifd ubusui}(
const void *indirect); void EdgeFlagv(boolean *flag); T components);
void NormalPointer(enum type, sizei stride,
void *pointer); void MultiDrawArrays(enum mode, Vertex Specification [2.7] void SecondaryColor3{bsifd ubusui}v(
type: see VertexPointer, plus BYTE int *first, sizei *count, sizei primcount); Vertices have two, three, or four coordinates, T components);
void ColorPointer(int size, enum type, void DrawElements(enum mode, and optionally a current normal, multiple void SecondaryColorP3ui(enum type,
sizei stride, void *pointer); sizei count, enum type, void *indices); current texture coordinate sets, multiple current uint coords)
type: see VertexPointer, plus BYTE, UBYTE, USHORT, UINT generic vertex attributes, current color, current
void DrawElementsInstanced(enum mode, secondary color, and current fog coordinates. void SecondaryColorP3uiv(enum type,
void SecondaryColorPointer(int size, sizei count, enum type, const void *indices, uint *coords)
enum type, sizei stride, void *pointer); sizei primcount); void Vertex{234}{sifd}(T coords);
type: see ColorPointer void Vertex{234}{sifd}v(T coords); void Index{sifd ub}(T index);
void MultiDrawElements(enum mode,
void IndexPointer(enum type, sizei stride, sizei *count, enum type, void **indices, void VertexP{234}ui(enum type, uint coords) void Index{sifd ub}v(T index);
void *pointer); sizei primcount); void VertexAttrib{1234}{sfd}(uint index,
type: UBYTE, SHORT, INT, FLOAT, DOUBLE void VertexP{234}uiv(enum type, uint *coords)
void DrawRangeElements(enum mode, type: INT_2_10_10_10_REV, T values);
void EdgeFlagPointer(sizei stride,
void *pointer); uint start, uint end, sizei count, UNSIGNED_INT_2_10_10_10_REV void VertexAttrib{123}{sfd}v(uint index,
enum type, void *indices); void TexCoord{1234}{sifd}(T coords); T values);
void FogCoordPointer(enum type,
sizei stride, void *pointer); void DrawElementsBaseVertex(enum mode, void TexCoord{1234}{sifd}v(T coords); void VertexAttrib4{bsifd ub us ui}v(
type: FLOAT, HALF_FLOAT, DOUBLE sizei count, enum type, void *indices, uint index, T values);
int basevertex); void TexCoordP{1234}ui(enum type,
void TexCoordPointer(int size, enum type, uint coords) void VertexAttrib4Nub(uint index, T values);
sizei stride, void *pointer); void DrawRangeElementsBaseVertex(
type: see VertexPointer enum mode, uint start, uint end, void TexCoordP{1234}uiv(enum type, void VertexAttrib4N{bsi ub us ui}v(
sizei count, enum type, void *indices, uint *coords) uint index, T values);
void VertexAttribPointer(uint index, int size,
enum type, boolean normalized, int basevertex); type: see VertexP{234}uiv void VertexAttribI{1234}{i ui}(uint index,
sizei stride, const void *pointer); void DrawElementsInstancedBaseVertex( void MultiTexCoord{1234}{sifd}( T values);
type: see ColorPointer enum mode, sizei count, enum type, enum texture, T coords) void VertexAttribI{1234}{i ui}v(uint index,
void VertexAttribIPointer(uint index, const void *indices, sizei primcount, T values);
int basevertex); void MultiTexCoord{1234}{sifd}v(
int size, enum type, sizei stride, enum texture, T coords) void VertexAttribI4{bs ub us}v(uint index,
const void *pointer); void DrawElementsIndirect(enum mode, texture: TEXTUREi (where i is T values);void VertexAttribP{1234}ui(
type: BYTE, UBYTE, SHORT, USHORT, INT, UINT enum type, const void *indirect); [0, MAX_TEXTURE_COORDS - 1]) uint index, enum type, boolean normalized,
index: [0, MAX_VERTEX_ATTRIBS - 1] void MultiDrawElementsBaseVertex( uint value)
void MultiTexCoordP{1234}ui(enum texture,
void EnableClientState(enum array); enum mode, sizei *count, enum type, enum type, uint coords) void VertexAttribP{1234}uiv(uint index,
void DisableClientState(enum array); void **indices, sizei primcount, enum type, boolean normalized, uint *value)
array: VERTEX_ARRAY, NORMAL_ARRAY, int *basevertex); void MultiTexCoordP{1234}uiv(
enum texture, enum type, uint *coords) type: see VertexP{234}uiv
COLOR_ARRAY, SECONDARY_COLOR_ARRAY, mode: POINTS, LINE_STRIP, LINE_LOOP, LINES,
INDEX_ARRAY, EDGE_FLAG_ARRAY, POLYGON, TRIANGLE_STRIP, TRIANGLE_FAN,
FOG_COORD_ARRAY, TEXTURE_COORD_ARRAY TRIANGLES, QUAD_STRIP, QUADS,
void EnableVertexAttribArray(uint index); LINES_ADJACENCY, LINE_STRIP_ADJACENCY, Mapping/Unmapping Buffer Data [2.9.3] void DeleteVertexArrays(sizei n,
PATCHES, TRIANGLES_ADJACENCY, void *MapBufferRange(enum target, const uint *arrays);
void DisableVertexAttribArray(uint index); intptr offset, sizeiptr length, void BindVertexArray(uint array);
index: [0, MAX_VERTEX_ATTRIBS - 1] TRIANGLE_STRIP_ADJACENCY
type: UNSIGNED_BYTE, UNSIGNED_SHORT, bitfield access);
void VertexAttribDivisor(uint index, UNSIGNED_INT access: The logical OR of MAP_{READ, WRITE}_BIT, Buffer Object Queries [6.1.9] [6.1.15]
uint divisor); MAP_INVALIDATE_{BUFFER, RANGE}_BIT, boolean IsBuffer(uint buffer);
void InterleavedArrays(enum format, MAP_FLUSH_EXPLICIT_BIT,
void ClientActiveTexture(enum texture); sizei stride, void *pointer); void GetBufferParameteriv(enum target,
index: TEXTUREi (where i is [0, MAX_TEXTURE_COORDS - 1]) MAP_UNSYNCHRONIZED_BIT enum pname, int *data);
format: V2F, V3F, C4UB_V2F, C4UB_V3F, C3F_V3F, target: see BindBuffer
void ArrayElement(int i); N3F_V3F, C4F_N3F_V3F, T2F_V3F, T4F_V4F, target: see BindBuffer
T2F_C4UB_V3F, T2F_C3F_V3F, T2F_N3F_V3F, void *MapBuffer(enum target, enum access); pname: BUFFER_SIZE, BUFFER_USAGE,
Enable/Disable(PRIMITIVE_RESTART) BUFFER_ACCESS{_FLAGS}, BUFFER_MAPPED,
T2F_C4F_N3F_V3F, T4F_C4F_N3F_V4F access: READ_ONLY, WRITE_ONLY, READ_WRITE
BUFFER_MAP_{OFFSET, LENGTH}
void FlushMappedBufferRange( void GetBufferParameteri64v(enum target,
enum target, intptr offset, sizeiptr length); enum pname, int64 *data);
Buffer Objects [2.9] void BindBufferBase(enum target,
uint index, uint buffer);
target: see BindBuffer target: see BindBuffer
void GenBuffers(sizei n, uint *buffers); boolean UnmapBuffer(enum target); pname: see GetBufferParameteriv,
target: see BindBufferRange
void DeleteBuffers(sizei n, const uint *buffers); target: see BindBuffer
Creating Buffer Object Data Stores [2.9.2] void GetBufferSubData(enum target,
Creating and Binding Buffer Objects [2.9.1] void BufferData(enum target, sizeiptr size, Copying Between Buffers [2.9.5] intptr offset, sizeiptr size, void *data);
void BindBuffer(enum target, uint buffer); void *CopyBufferSubData(enum readtarget, target: see BindBuffer
const void *data, enum usage);
target: ARRAY_BUFFER, COPY_{READ, WRITE}_BUFFER, usage: STREAM_{DRAW, READ, COPY}, enum writetarget, intptr readoffset, void GetBufferPointerv(enum target,
DRAW_INDIRECT_BUFFER, ELEMENT_ARRAY_BUFFER, STATIC_{DRAW, READ, COPY}, intptr writeoffset, sizeiptr size); enum pname, void **params);
PIXEL_PACK_BUFFER, PIXEL_UNPACK_BUFFER, DYNAMIC_ {DRAW, READ, COPY} readtarget and writetarget: see BindBuffer target: see BindBuffer
TEXTURE_BUFFER, TRANSFORM_FEEDBACK_BUFFER, target: see BindBuffer pname: BUFFER_MAP_POINTER
UNIFORM_BUFFER Vertex Array Objects [2.10]
void BindBufferRange(enum target, uint index, void BufferSubData(enum target, All states related to definition of data used by Vertex Array Object Queries
uint buffer, intptr offset, sizeiptr size); intptr offset, sizeiptr size, vertex processor is in a vertex array object. [6.1.10] [6.1.16]
target: TRANSFORM_FEEDBACK_BUFFER, const void *data); void GenVertexArrays(sizei n, uint *arrays);
target: see BindBuffer boolean IsVertexArray(uint array);
UNIFORM_BUFFER

©2010 Khronos Group - Rev. 0210 www.opengl.org/registry


OpenGL 4.00 API Quick Reference Card
Rectangles, Matrices, Texture Lighting and Color Rendering Control & Queries void DrawTransformFeedback(
enum mode, uint id);
Coordinates Enable/Disable(LIGHTING) // generic enable Asynchronous Queries [2.15] [2.18]
void DrawTransformFeedbackStream(
Enable/Disable(LIGHTi) // indiv. lights void BeginQuery(enum target, uint id);
Rectangles [2.11] target: PRIMITIVES_GENERATED{n}, enum mode, uint id, uint stream);
Specifiy rectangles as two corner vertices. Lighting Parameter Spec. [2.13.2] {ANY_}SAMPLES_PASSED, TIME_ELAPSED, Transform Feedback Query
void Rect{sifd}(T x1, T y1, T x2, T y2); void Material{if}(enum face, TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN{n} [6.1.11] [6.1.17]
void Rect{sifd}v(T v1[2], T v2[2]); enum pname, T param); void EndQuery(enum target); boolean IsTransformFeedback(uint id);
void Material{if}v(enum face, void BeginQueryIndexed(enum target,
Matrices [2.12.1] enum pname, T params); uint index, uint id); Current Raster Position [2.25]
void MatrixMode(enum mode); face: FRONT, BACK, FRONT_AND_BACK void RasterPos{234}{sifd}(T coords);
mode: TEXTURE, MODELVIEW, COLOR, PROJECTION pname: AMBIENT, DIFFUSE, SPECULAR, void EndQueryIndexed(enum target, void RasterPos{234}{sifd}v(T coords);
AMBIENT_AND_DIFFUSE, EMISSION, SHININESS, uint index);
void LoadMatrix{fd}(T m[16]); COLOR_INDEXES void GenQueries(sizei n, uint *ids); void WindowPos{23}{sifd}(T coords);
void MultMatrix{fd}(T m[16]); void DeleteQueries(sizei n, const uint *ids); void WindowPos{23}{sifd}v(T coords);
void Light{if}(enum light, enum pname,
void LoadTransposeMatrix{fd}(T m[16]); T param); Asynch. State Queries [6.1.7] [6.1.13]
Conditional Rendering [2.16] [2.19]
void MultTransposeMatrix{fd}(T m[16]); void Light{if}v(enum light, enum pname, void BeginConditionalRender(uint id, boolean IsQuery(uint id);
void LoadIdentity(void); T params); enum mode); void GetQueryiv(enum target,
void Rotate{fd}(Ty, T x, T y, T z); light: LIGHTi (where i >= 0) enum pname, int *params);
pname: AMBIENT, DIFFUSE, SPECULAR,POSITION, void EndConditionalRender(void);
void Translate{fd}(T x, T y, T z); mode: QUERY_WAIT, QUERY_NO_WAIT, target: see BeginQuery, plus TIMESTAMP
SPOT_{DIRECTION, EXPONENT, CUTOFF}, QUERY_BY_REGION_{WAIT, NO_WAIT} pname: CURRENT_QUERY, QUERY_COUNTER_BITS
void Scale{fd}(T x, T y, T z); {CONSTANT, LINEAR,QUADRATIC}_ATTENUATION
void Frustum(double l, double r, double b, Transform Feedback [2.17] [2.20] void GetQueryIndexediv(enum target,
void LightModel{if}(enum pname, uint index, enum pname, int *params);
double t, double n, double f); T param); void GenTransformFeedbacks(sizei n, uint *ids); target: see BeginQuery
void Ortho(double l, double r, double b, void LightModel{if}v(enum pname, void DeleteTransformFeedbacks(sizei n, pname: CURRENT_QUERY, QUERY_COUNTER_BITS
double t, double n, double f); T params); const uint *ids); void GetQueryObjectiv(uint id,
void PushMatrix(void); pname: LIGHT_MODEL_{AMBIENT, LOCAL_VIEWER}, void BindTransformFeedback( enum pname, int *params);
LIGHT_MODEL_{TWO_SIDE, COLOR_CONTROL} enum target, uint id);
void PopMatrix(void); target: TRANSFORM_FEEDBACK void GetQueryObjectuiv(uint id,
ColorMaterial [4.3.1] [2.13.3, 3.7.5] void BeginTransformFeedback( enum pname, uint *params);
Generating Texture Coords. [2.12.3] Enable/Disable(COLOR_MATERIAL) enum primitiveMode); void GetQueryObjecti64v(uint id,
void TexGen{ifd}(enum coord, enum pname, primitiveMode: TRIANGLES, LINES, POINTS enum pname, int64 *params);
T param); void ColorMaterial(enum face, enum mode);
face: FRONT, BACK, FRONT_AND_BACK void EndTransformFeedback(void);void void GetQueryObjectui64v(uint id,
void TexGen{ifd}v(enum coord, mode: EMISSION, AMBIENT, DIFFUSE, SPECULAR, PauseTransformFeedback(void); enum pname, uint64 *params);
enum pname, T *params); AMBIENT_AND_DIFFUSE void ResumeTransformFeedback(void); pname: QUERY_RESULT{_AVAILABLE}
coord: S, T, R, Q
pname: TEXTURE_GEN_MODE, OBJECT_PLANE, void ClampColor(enum target, enum clamp);
EYE_PLANE target: CLAMP_VERTEX_COLOR
clamp: TRUE, FALSE, FIXED_ONLY
Uniform Buffer Object Bindings
void UniformBlockBinding(uint program,
Shader Queries
uint uniformBlockIndex, Shader Queries [6.1.12] [6.1.18]
Flatshading [2.19] [2.22]
Viewport and Clipping void ProvokingVertex(enum provokeMode);
uint uniformBlockBinding); boolean IsShader(uint shader);
Controlling the Viewport [2.17] provokeMode: {FIRST, LAST}_VERTEX_CONVENTION Subroutine Uniform Variables void GetShaderiv(uint shader, enum
void DepthRange(clampd n, clampd f); void ShadeModel(enum mode); [2.11.5] [2.14.5] pname, int *params);
void Viewport(int x, int y, sizei w, sizei h); mode: SMOOTH, FLAT pname: SHADER_TYPE, {DELETE,COMPILE}_STATUS,
int GetSubroutineUniformLocation( INFO_LOG_LENGTH, SHADER_SOURCE_LENGTH
Queries [6.1.3] uint program, enum shadertype,
Clipping [2.23, 6.1.3] const char *name); void GetShaderInfoLog(uint shader,
Enable/Disable(CLIP_DISTANCEi) void GetLight{if}v(enum light, enum value, sizei bufSize, sizei *length, char *infoLog);
i: [0, MAX_CLIP_DISTANCES - 1] T data); uint GetSubroutineIndex(uint program,
enum shadertype, const char *name); void GetShaderSource(uint shader,
void ClipPlane(enum p, double eqn[4]); void GetMaterial{if}v(enum face, sizei bufSize, sizei *length, char *source);
p: CLIP_PLANEi (where i is [0, MAX_CLIP_PLANES - 1]) enum value, T data); void GetActiveSubroutineUniformiv(
uint program, enum shadertype, void GetProgramStageiv(uint program,
void GetClipPlane(enum plane, double eqn[4]); face: FRONT, BACK enum shadertype, enum pname,
uint index, enum pname, int *values);
pname: {NUM_}COMPATIBLE_SUBROUTINES, int *values);
pname: ACTIVE_SUBROUTINE_{UNIFORMS,
Shaders and Programs pname: UNIFORM_BLOCK_{BINDING, DATA_SIZE},
UNIFORM_BLOCK_NAME_{LENGTH, UNIFORM},
UNIFORM_SIZE, UNIFORM_NAME_LENGTH
void GetActiveSubroutineUniformName(
MAX_LENGTH}, ACTIVE_SUBROUTINES,
Shader Objects [2.11.1] [2.14.1] UNIFORM_BLOCK_ACTIVE_UNIFORMS_INDICES, ACTIVE_SUBROUTINE_UNIFORM_{LOCATIONS,
uint program, enum shadertype, MAX_LENGTH}
uint CreateShader(enum type); UNIFORM_BLOCK_REFERENCED_BY_{VERTEX_SHADER, uint index, sizei bufsize, sizei *length,
type: {VERTEX, FRAGMENT, GEOMETRY}_SHADER, FRAGMENT_SHADER, GEOMETRY_SHADER,
TESS_{EVALUATION, CONTROL}_SHADER char *name); Program Queries [6.1.12] [6.1.18]
TESS_CONTROL_SHADER, TESS_EVALUATION_SHADER}
void ShaderSource(uint shader, sizei count, void GetActiveSubroutineName( void GetAttachedShaders(uint program,
void GetUniformIndices(uint program, uint program, enum shadertype, sizei maxCount, sizei *count,
const char **string, const int *length); sizei uniformCount, const char **uniformNames, uint index, sizei bufsize, sizei *length, uint *shaders);
void CompileShader(uint shader); uint *uniformIndices); char *name);
void DeleteShader(uint shader); void GetVertexAttrib{d f i}v(uint index,
void GetActiveUniformName(uint program, void UniformSubroutinesuiv( enum pname, T *params);
uint uniformIndex, sizei bufSize, sizei *length, enum shadertype, sizei count, pname: VERTEX_ATTRIB_ARRAY_{BUFFER_BINDING,
Program Objects [2.11.2] [2.14.2] char *uniformName); const uint *indices);
uint CreateProgram(void); ENABLED, SIZE, STRIDE, TYPE, NORMALIZED,
GetActiveUniform(uint program, DIVISOR , INTEGER}, CURRENT_VERTEX_ATTRIB
void AttachShader(uint program, uint shader); voiduint index, sizei bufSize, sizei *length,
Varying Variables [2.11.7] [2.14.7]
void DetachShader(uint program, uint shader);
void TransformFeedbackVaryings( void GetVertexAttribl{i ui}v(uint index,
int *size, enum *type, char *name); uint program, sizei count, enum pname, T *params);
void LinkProgram(uint program); *type returns: DOUBLE, DOUBLE_{VECn, MATn, const char **varyings, enum bufferMode); pname: see GetVertexAttrib{d f i}v
void UseProgram(uint program); MATnxn}, FLOAT, FLOAT_{VECn, MATn, MATnxn}, INT, bufferMode: {INTERLEAVED, SEPARATE}_ATTRIBS
INT_VECn, UNSIGNED_INT, UNSIGNED_INT_VECn, void GetVertexAttribPointerv(uint index,
void DeleteProgram(uint program); BOOL, BOOL_VECn, and the SAMPLER_*, INT_
void GetTransformFeedbackVarying( enum pname, void **pointer);
uint program, uint index, sizei bufSize, pname: VERTEX_ATTRIB_ARRAY_POINTER
Vertex Attributes [2.11.3] [2.14.3] SAMPLER_*, and UNSIGNED_INT_SAMPLER_* values sizei *length, sizei *size, enum *type,
in [Table 2.12] [Table 2.15] char *name); void GetUniform{f d i ui}v(uint program,
Vertex shaders operate on array of 4-comp. items int location, T *params)
numbered from slot 0 to MAX_VERTEX_ATTRIBS - 1. void GetActiveUniformsiv(uint program, *type returns NONE, FLOAT, FLOAT_VECn, DOUBLE,
sizei uniformCount, const uint *uniformIndices, DOUBLE_VECn, {UNSIGNED_}INT, INT_VECn, void GetUniformSubroutineuiv(
void GetActiveAttrib(uint program, uint index, UNSIGNED_INT_VECn, FLOAT_MATn, MATnxm, enum shadertype, int location,
sizei bufSize, sizei *length, int *size, enum pname, int *params);
pname: UNIFORM_{TYPE, SIZE, NAME_LENGTH}, DOUBLE_MATn, {FLOAT, DOUBLE}_MATnxm. uint *params);
enum *type, char *name);
*type returns: FLOAT, FLOAT_{VECn, MATn, MATnxm}, UNIFORM_BLOCK_INDEX, UNIFORM_OFFSET, Shader Execution [2.11.8] [2.14.8] boolean IsProgram(uint program);
INT, INT_VECn, UNSIGNED_{INT, INT_VECn} UNIFORM_{ARRAY, MATRIX}_STRIDE, void ValidateProgram(uint program); void GetProgramiv(uint program,
UNIFORM_IS_ROW_MAJOR
int GetAttribLocation(uint program, Tessellation Control Shaders enum pname, int *params);
const char *name); Load Uniform Variables In Default Uniform Block [2.12.1] [2.15.1] pname: {DELETE, LINK, VALIDATE}_STATUS,
void BindAttribLocation(uint program, void Uniform{1234}{ifd}(int location, T value); void PatchParameterfv(enum pname, INFO_LOG_LENGTH, ATTACHED_SHADERS,
uint index, const char *name); const float *values); ACTIVE_{ATTRIBUTES, UNIFORMS},
void Uniform{1234}{ifd}v(int location, ACTIVE_{ATTRIBUTES, UNIFORM}_MAX_LENGTH,
sizei count, T value); pname: PATCH_DEFAULT_{INNER, OUTER}_LEVEL
Uniform Variables [2.11.4] [2.14.4] TRANSFORM_FEEDBACK_{BUFFER_MODE,
int GetUniformLocation(uint program, void Uniform{1234}ui(int location, T value); Fragment Shaders [3.9.2] [3.12.2] VARYINGS}, ACTIVE_UNIFORM_BLOCKS,
const char *name); TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH,
void Uniform{1234}uiv(int location, void BindFragDataLocation(uint program, ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH,
uint GetUniformBlockIndex(uint program, sizei count, T value); uint colorNumber, const char *name); GEOMETRY_VERTICES_OUT,
const char *uniformBlockName); void BindFragDataLocationIndexed( GEOMETRY_{INPUT, OUTPUT}_TYPE,
void GetActiveUniformBlockName(uint program, void UniformMatrix{234}{fd}v(int location, uint program, uint colorNumber, GEOMETRY_SHADER_INVOCATIONS,
uint uniformBlockIndex, sizei bufSize, sizei count, boolean transpose, uint index, const char *name); TESS_CONTROL_OUTPUT_VERTICES,
sizei *length, char *uniformBlockName); const T *value); TESS_GEN_{MODE, SPACING},
int GetFragDataLocation(uint program,
void GetActiveUniformBlockiv(uint program, void UniformMatrix{2x3,3x2,2x4,4x2, const char *name); TESS_GEN_{VERTEX_ORDER, POINT_MODE}
uint uniformBlockIndex, enum pname, 3x4,4x3}{fd}v(int location, sizei count, void GetProgramInfoLog(uint program, sizei
boolean transpose, const T *value); int GetFragDataIndex(uint program,
int *params); const char *name); bufSize, sizei *length, char *infoLog);
(parameters )

©2010 Khronos Group - Rev. 0210 www.opengl.org/registry


www.opengl.org/registry
OpenGL 4.00 API Quick Reference Card
Rasterization [3] Pixel Transfer Modes [3.7.3, 6.1.3] Convolution Filter Specification [3.7.3]
void PixelTransfer{if}(enum param, T value); Enable/Disable(
Histogram Query [6.1.10]
void GetHistogram(enum target,
Enable/Disable(target) param: MAP_{COLOR, STENCIL}, POST_CONVOLUTION_COLOR_TABLE) boolean reset, enum format, enum type,
target: RASTERIZER_DISCARD, MULTISAMPLE, void *values);
SAMPLE_SHADING INDEX_{SHIFT, OFFSET}, x_ {SCALE, BIAS}, void ConvolutionFilter2D(enum target,
DEPTH_{SCALE, BIAS}, enum internalformat, sizei width, target: HISTOGRAM
Multisampling [3.3.1] POST_CONVOLUTION_x_{SCALE, BIAS}, sizei height, enum format, enum type, format and type: see GetTexImage, omitting
POST_COLOR_MATRIX_x_{SCALE, BIAS}, (where void *data); DEPTH_COMPONENT for format
Use to antialias points, lines, polygons,
bitmaps, and images. x is RED, GREEN, BLUE, or ALPHA) [Table 3.2] target: CONVOLUTION_2D void ResetHistogram(enum target);
void PixelMap{ui us f}v(enum map, sizei internalformat: see ColorTable target: HISTOGRAM
void GetMultisamplefv(enum pname,
uint index, float *val); size, T values); format: RED, GREEN, BLUE, ALPHA, RG, RGB, RGBA, void GetHistogramParameter{if}v(
pname: SAMPLE_POSITION map: PIXEL_MAP_x_TO_x (where x may be BGRA, LUMINANCE, LUMINANCE_ALPHA enum target, enum pname, T params);
{I,S,R,G,B,A}), PIXEL_MAP_I_TO_{R,G,B,A} type: BYTE, SHORT, INT, FLOAT, HALF_FLOAT, target: HISTOGRAM, PROXY_HISTOGRAM
void MinSampleShading(clampf value); [Table 3.3] pname: HISTOGRAM_x (where x may be FORMAT,
UNSIGNED_{BYTE, SHORT, INT}
Points [3.4] void GetPixelMap{ui us f}v(enum map, void ConvolutionFilter1D(enum target, WIDTH, {RED, GREEN, BLUE, ALPHA}_SIZE,
T data); LUMINANCE_SIZE, SINK)
void PointSize(float size); enum internalformat, sizei width,
void PointParameter{if}(enum pname, map: see PixelMap{ui us f}v enum format, enum type, void *data); Minmax Table Specification [3.7.3]
T param); target: CONVOLUTION_1D Enable/Disable(MINMAX)
void PointParameter{if}v(enum pname,
Color Table Specification [3.7.3] internalformat, format, type: see ConvolutionFilter2D
void ColorTable(enum target, void Minmax(enum target,
const T params); void ConvolutionParameter{if}v( enum internalformat, boolean sink);
pname: POINT_SIZE_MIN, POINT_SIZE_MAX, enum internalformat, sizei width,
enum format, enum type, void *data); enum target, enum pname, T params); target: MINMAX
POINT_DISTANCE_ATTENUATION, POINT_FADE_ target: CONVOLUTION_2D internalformat: see ColorTable, omitting the values
THRESHOLD_SIZE, POINT_SPRITE_COORD_ORIGIN target: {PROXY_}COLOR_TABLE, 1, 2, 3, 4 and INTENSITY base and sized internal
param, params: LOWER_LEFT, UPPER_LEFT, pointer {PROXY_}POST_CONVOLUTION_COLOR_TABLE, pname: CONVOLUTION_FILTER_{SCALE, BIAS}
formats
to point fade threshold {PROXY_}POST_COLOR_MATRIX_COLOR_TABLE void SeparableFilter2D(enum target,
Enable/Disable (target) internalformat: The formats in [Table 3.16] or enum internalformat, sizei width, Minmax Query [6.1.11]
target: VERTEX_PROGRAM_POINT_SIZE, [Tables 3.17-3.19] except RED, RG, sizei height, enum format, enum type, void GetMinmax(enum target,
POINT_SMOOTH, POINT_SPRITE. DEPTH_{COMPONENT, STENCIL} base and void *row, void *column); boolean reset, enum format, enum type,
sized internal formats in those tables, all sized target: SEPARABLE_2D void *values);
Line Segments [3.5] internal formats with non-fixed internal data internalformat, format, type: see ConvolutionFilter2D target: MINMAX
void LineWidth(float width); types as discussed in [3.9], and RGB9_E5. Alt. Convolution Filter Spec. Commands format and type: see GetTexImage, omitting
Enable/Disable(LINE_SMOOTH) format: RED, GREEN, BLUE, ALPHA, RG, RGB, RGBA, void CopyConvolutionFilter2D(enum target, DEPTH_COMPONENT for format
BGRA, LUMINANCE, LUMINANCE_ALPHA enum internalformat, int x, int y, void ResetMinmax(enum target);
Other Line Seg. Features [3.5.2, 6.1.6] type: see DrawPixels sizei width, sizei height); target: MINMAX
void LineStipple(int factor, ushort pattern); Enable/Disable( target: CONVOLUTION_2D void GetMinmaxParameter{if}v(
Enable/Disable(LINE_STIPPLE) POST_COLOR_MATRIX_COLOR_TABLE) internalformat: see ConvolutionFilter2D enum target, enum pname, T params);
target: MINMAX
void GetIntegerv(LINE_STIPPLE_PATTERN); void ColorTableParameter{if}v(enum target, void CopyConvolutionFilter1D(enum target, pname: MINMAX_FORMAT, MINMAX_SINK
enum pname, T params); enum internalformat, int x, int y,
Polygons [3.6] target: POST_COLOR_MATRIX_COLOR_TABLE, sizei width); Rasterization of Pixel Rectangles [4.3.1] [3.7.5]
Enable/Disable(target) {POST_CONVOLUTION_}COLOR_TABLE target: CONVOLUTION_1D void DrawPixels(sizei width, sizei height,
target: POLYGON_STIPPLE, POLYGON_SMOOTH, internalformat: see ConvolutionFilter2D
CULL_FACE
pname: COLOR_TABLE_SCALE, COLOR_TABLE_BIAS enum format, enum type, void *data);
Convolution Query [6.1.9] format: {COLOR|STENCIL}_INDEX,
void FrontFace(enum dir); Alt. Color Table Specification Commands void GetConvolutionFilter(enum target, DEPTH_{COMPONENT, STENCIL}, RED, GREEN,
dir: CCW, CW void CopyColorTable(enum target, enum format, enum type, void *image); BLUE, ALPHA, RG, RGB, RGBA, BGR, BGRA,
void CullFace(enum mode); enum internalformat, int x, int y, target: CONVOLUTION_1D, CONVOLUTION_2D LUMINANCE{_ALPHA} (*_INTEGER formats from
mode: FRONT, BACK, FRONT_AND_BACK sizei width); format and type: see GetTexImage, omitting {Table 3.6} are not supported)
void ColorSubTable(enum target, sizei start, DEPTH_COMPONENT in format type: BITMAP, BYTE, SHORT, INT, FLOAT, HALF_FLOAT,
Stippling [3.6.2] sizei count, enum format, enum type, UNSIGNED_{BYTE, SHORT, INT}, or value from
void PolygonStipple(ubyte *pattern); void GetSeparableFilter(enum target, [Table 3.5]
void *data); enum format, enum type, void *row,
void GetPolygonStipple(void *pattern); void CopyColorSubTable(enum target, void *column, void *span); void ClampColor(enum target, enum clamp);
sizei start, int x, int y, sizei count); target: SEPARABLE_2D target: CLAMP_READ_COLOR,
Polygon Rasterization & Depth Offset CLAMP_{FRAGMENT, VERTEX}_COLOR
[3.6.3 - 3.6.4] [3.6.4 - 3.6.5] target and pname: see ColorTableParameter{if}v format and type: see GetTexImage
clamp: TRUE, FALSE, FIXED_ONLY
void PolygonMode(enum face, enum mode); Color Table Query [6.1.8] void GetConvolutionParameter{if}v(
face: FRONT, BACK, FRONT_AND_BACK void GetColorTable(enum target, enum target, enum pname, T params); void PixelZoom(float zx, float zy);
mode: POINT, LINE, FILL enum format, enum type, void *table); target: CONVOLUTION_1D, CONVOLUTION_2D,
SEPARABLE_2D Pixel Transfer Operations [3.7.6]
void PolygonOffset(float factor, float units); target: see ColorTableParameter{if}v void ConvolutionParameter{if}(
format and type: see GetTexImage, omitting pname: {MAX_}CONVOLUTION_{WIDTH, HEIGHT},
Enable/Disable(target) CONVOLUTION_x (where x may be FILTER_BIAS, enum target, enum pname, T param);
DEPTH_COMPONENT for format target: CONVOLUTION_1D, CONVOLUTION_2D,
target: POLYGON_OFFSET_POINT, BORDER_COLOR, BORDER_MODE, FILTER_SCALE,
POLYGON_OFFSET_{LINE, FILL} void GetColorTableParameter{if}v( FORMAT)
SEPARABLE_2D
enum target, enum pname, T params); pname: CONVOLUTION_BORDER_MODE
Pixel Storage Modes & Buffer Objects [3.7.1] target: see ColorTable Histogram Table Specification [3.7.3] param: REDUCE, {CONSTANT, REPLICATE_}BORDER
void PixelStore{if}(enum pname, T param); pname: COLOR_TABLE_x (where x may be void Histogram(enum target, sizei width,
pname: {UN}PACK_x (where x may be SWAP_BYTES, SCALE, BIAS, FORMAT, COLOR_TABLE_WIDTH, enum internalformat, boolean sink); Bitmaps [3.8]
LSB_FIRST, ROW_LENGTH, SKIP_{PIXELS, ROWS}, RED_SIZE, GREEN_SIZE, BLUE_SIZE, ALPHA_SIZE, target: HISTOGRAM, PROXY_HISTOGRAM void Bitmap(sizei w, sizei h, float xb0,
ALIGNMENT, IMAGE_HEIGHT, SKIP_IMAGES) LUMINANCE_SIZE, INTENSITY_SIZE) internalformat: see ColorTable except 1, 2, 3, and 4 float yb0, float xbi, float ybi, ubyte *data);

Texturing [3.8] [3.9] TEXTURE_{MIN,MAX}_LOD,


TEXTURE_BORDER_COLOR, TEXTURE_LOD_BIAS,
void TexImage2D(enum target, int level,
int internalformat, sizei width,
target: TEXTURE_3D, TEXTURE_2D_ARRAY,
TEXTURE_CUBE_MAP_ARRAY
void ActiveTexture(enum texture); TEXTURE_COMPARE_{MODE, FUNC} sizei height, int border, enum format, format and type: see TexImage3D
texture: TEXTUREi (where i is enum type, void *data);
[0, MAX(MAX_TEXTURE_COORDS, void DeleteSamplers(sizei count, void TexSubImage2D(enum target, int level,
MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1]) const uint *samplers); target: {PROXY_}TEXTURE_{2D, RECTANGLE,CUBE_MAP}, int xoffset, int yoffset, sizei width,
{PROXY_}TEXTURE_1D_ARRAY, sizei height, enum format, enum type,
Texture Objects [3.8.1] [3.9.1] Texture Image Spec. [3.8.3] [3.9.3] TEXTURE_CUBE_MAP_{POSITIVE, NEGATIVE}_{X, Y, Z}, void *data);
void BindTexture(enum target, uint texture); void TexImage3D(enum target, int level, internalformat, format, and type: see TexImage3D target: see CopyTexImage2D
target: TEXTURE_{1, 2}D{_ARRAY}, int internalformat, sizei width, void TexImage1D(enum target, int level, format and type: see TexImage2D
TEXTURE_{3D, RECTANGLE, BUFFER}, sizei height, sizei depth, int border, int internalformat, sizei width, int border,
TEXTURE_CUBE_MAP{_ARRAY}, enum format, enum type, void *data); enum format, enum type, void *data); void TexSubImage1D(enum target, int level,
TEXTURE_2D_MULTISAMPLE{_ARRAY} target: {PROXY_}TEXTURE_3D, target: TEXTURE_1D, PROXY_TEXTURE_1D int xoffset, sizei width, enum format,
void DeleteTextures(sizei n, uint *textures); {PROXY_}TEXTURE_2D_ARRAY, type, internalformat, and format: see TexImage3D enum type, void *data);
{PROXY_}TEXTURE_CUBE_MAP_ARRAY target: TEXTURE_1D
void GenTextures(sizei n, uint *textures); internalformat: ALPHA, DEPTH_COMPONENT, Alt. Tex. Image Specification [3.8.4] [3.9.4] format, type: see TexImage1D
boolean AreTexturesResident(sizei n, DEPTH_STENCIL, LUMINANCE{_ALPHA}, RED, void CopyTexImage2D(enum target, void CopyTexSubImage3D(enum target,
uint *textures, boolean *residences); INTENSITY, RG, RGB, RGBA; or a sized internal int level, enum internalformat, int x, int level, int xoffset, int yoffset, int zoffset,
void PrioritizeTextures(sizei n, format from [Tables 3.12-3.13] [Tables 3.17-3.19]; int y, sizei width, sizei height, int border); int x, int y, sizei width, sizei height);
COMPRESSED_{SIGNED_}{RED_RGTC1,RG_RGTC2}, target: TEXTURE_{2D, RECTANGLE}, TEXTURE_1D_ARRAY, target: see TexSubImage3D
uint *textures, clampf *priorities); or a generic comp. format in [Table 3.14] [Table 3.20] TEXTURE_CUBE_MAP_{POSITIVE, NEGATIVE}_{X, Y, Z}
Sampler Objects [3.8.2] [3.9.2] format: COLOR_INDEX, DEPTH_{COMPONENT, STENCIL}, internalformat: see TexImage2D, except 1, 2, 3, 4 void CopyTexSubImage2D(enum target,
RED, GREEN, BLUE, ALPHA, RG, RGB, RGBA, BGR, int level, int xoffset, int yoffset, int x, int y,
void GenSamplers(sizei count, void CopyTexImage1D(enum target, sizei width, sizei height);
uint *samplers); BGRA, LUMINANCE{_ALPHA}, {RED, GREEN, BLUE, int level, enum internalformat, int x,
ALPHA}_INTEGER, RG_INTEGER, RGB_INTEGER, target: TEXTURE_2D, TEXTURE_1D_ARRAY,
void BindSampler(uint unit, uint sampler); int y, sizei width, int border); TEXTURE_RECTANGLE,
RGBA_INTEGER, BGR_INTEGER, BGRA_INTEGER target: TEXTURE_1D
[Table 3.3] [Table 3.6] TEXTURE_CUBE_MAP_{POSITIVE, NEGATIVE}_{X, Y, Z}
void SamplerParameter{if}v(uint sampler, internalformat: see TexImage1D, except 1, 2, 3, 4
enum pname, T param); type: BITMAP, BYTE, UNSIGNED_BYTE, SHORT,
void TexSubImage3D(enum target, int level, void CopyTexSubImage1D(enum target,
UNSIGNED_SHORT, INT, UNSIGNED_INT,
int xoffset, int yoffset, int zoffset, int level, int xoffset, int x, int y, sizei
void SamplerParameterI{u ui}v(uint sampler, HALF_FLOAT, FLOAT, or a value from width);
enum pname, T *params); [Table 3.2] [Table 3.5] sizei width, sizei height, sizei depth,
enum format, enum type, void *data); target: TEXTURE_1D
pname: TEXTURE_WRAP_{S, T, R},
TEXTURE_{MIN, MAG}_FILTER, (Continued
(Continued >)
>)
(more parameters ) (parameters )

©2010 Khronos Group - Rev. 0210 www.opengl.org/registry


OpenGL 4.00 API Quick Reference Card
Texturing (continued) Multisample Textures [3.8.6] [3.9.6]
void TexImage3DMultisample(enum target,
Texture Minification [3.8.11] [3.9.11]
void GenerateMipmap(enum target);
target: {PROXY_}TEXTURE_{1D, 2D, 3D},
TEXTURE_BUFFER, PROXY_TEXTURE_CUBE_MAP,
Compressed Texture Images [3.8.5] [3.9.5] sizei samples, int internalformat, target: TEXTURE_{1D, 2D, 3D}, TEXTURE_{1D, 2D}_ARRAY, {PROXY_}TEXTURE_{1D, 2D}_ARRAY,
void CompressedTexImage3D(enum target, sizei width, sizei height, sizei depth, TEXTURE_CUBE_MAP{_ARRAY}. {PROXY_}TEXTURE_CUBE_MAP_ARRAY,
int level, enum internalformat, sizei width, boolean fixedsamplelocations); Texture Environments & Functions [3.9.16]
{PROXY_}TEXTURE_RECTANGLE,
target: {PROXY_}TEXTURE_2D_MULTISAMPLE_ARRAY TEXTURE_CUBE_MAP_{POSITIVE, NEGATIVE}_{X, Y, Z},
sizei height, sizei depth, int border, void TexEnv{if}(enum target, enum pname, TEXTURE_2D_MULTISAMPLE{_ARRAY},
sizei imageSize, void *data); internalformat: ALPHA, RED, RG, RGB, RGBA,
DEPTH_{COMPONENT, STENCIL}, STENCIL_INDEX, T param); PROXY_TEXTURE_2D_MULTISAMPLE,
target: see TexImage3D
internalformat: COMPRESSED_RED_RGTC1_RED, or sized internal formats corresponding to these void TexEnv{if}v(enum target, enum pname, PROXY_TEXTURE_2D_MULTISAMPLE{_ARRAY}
COMPRESSED_SIGNED_RED_RGTC1_RED, base formats T params); value: TEXTURE_{WIDTH, HEIGHT, DEPTH},
COMPRESSED_RG_RGTC2_RG, target: TEXTURE_{FILTER_CONTROL, ENV}, POINT_SPRITE TEXTURE_{BORDER, COMPONENTS, SAMPLES},
void TexImage2DMultisample(enum target, pname: TEXTURE_LOD_BIAS, TEXTURE_ENV_MODE, TEXTURE_FIXED_SAMPLE_LOCATIONS,
COMPRESSED_SIGNED_RG_RGTC2 sizei samples, int internalformat, sizei width, TEXTURE_ENV_COLOR, COMBINE_{RGB, ALPHA}, TEXTURE_{INTERNAL_FORMAT, SHARED_SIZE},
void CompressedTexImage2D(enum target, sizei height,boolean fixedsamplelocations); {RGB, ALPHA}_SCALE, COORD_REPLACE, SRCn_RGB, TEXTURE_COMPRESSED{_IMAGE_SIZE},
int level, enum internalformat, sizei width, target: {PROXY_}TEXTURE_2D_MULTISAMPLE SRCn_ALPHA, OPERANDn_RGB, OPERANDn_ALPHA TEXTURE_BUFFER_DATA_STORE_BINDING,
sizei height, int border, sizei imageSize, internalformat: see TexImage3DMultisample (where n is [0, 1, 2]) TEXTURE_x_{SIZE, TYPE} (where x can be RED,
void *data); Buffer Textures [3.8.7] [3.9.7] GREEN, BLUE, ALPHA, LUMINANCE, INTENSITY,
target: see TexImage2D, omitting compressed void TexBuffer(enum target, Texture Application [3.8.18] [3.9.20] DEPTH, STENCIL)
rectangular texture formats enum internalformat, uint buffer); Enable/Disable(param)
param: TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, Texture Queries [6.1.4]
internalformat: see CompressedTexImage3D target: TEXTURE_BUFFER void GetTexImage(enum tex, int lod,
TEXTURE_CUBE_MAP
internalformat: R8{I,UI}, R16{F, I, UI}, R32{F, I, UI}, enum format, enum type, void *img);
void CompressedTexImage1D(enum target, RG8{I, UI}, RG16{F, I, UI}, RG32{F, I, UI}, Enumerated Queries [6.1.3]
int level, enum internalformat, sizei width, tex: TEXTURE_{1, 2}D{_ARRAY}, TEXTURE_3D,
int border, sizei imageSize, void *data);
RGB32{F, I, UI}, RGBA8{I, UI}, RGBA16{F, I, UI}, void GetTexEnv{if}v(enum env, enum value, TEXTURE_RECTANGLE, TEXTURE_CUBE_MAP_ARRAY,
target: TEXTURE_1D, PROXY_TEXTURE_1D
RGBA32{F, I, UI} T data); TEXTURE_CUBE_MAP_{POSITIVE,NEGATIVE}_{X, Y, Z}
internalformat: values are implementation-dependent env: POINT_SPRITE, TEXTURE_{ENV,FILTER_CONTROL} format: see TexImage3D
Texture Parameters [3.8.8] [3.9.8]
void TexParameter{if}(enum target, void GetTexGen{ifd}v(enum coord, type: BITMAP, {UNSIGNED_}BYTE, UNSIGNED_{SHORT},
void CompressedTexSubImage3D( enum value, T data); {UNSIGNED_}INT, {HALF_}FLOAT, or a value from
enum target, int level, int xoffset, int yoffset, enum pname, T param); [Table 3.2] [Table 3.5]
coord: S, T, R, Q
int zoffset, sizei width, sizei height, sizei void TexParameter{if}v(enum target, void GetCompressedTexImage(enum target,
depth, enum format, sizei imageSize, enum pname, T *params); void GetTexParameter{if}v(enum target,
enum value, T data); int lod, void *img);
void *data); void TexParameterI{i ui}v(enum target, enum target: see “tex” for GetTexImage
target: see TexSubImage3D pname, T *params); void GetTexParameterI{i ui}v(enum target,
format: see internalformat for CompressedTexImage3D target: TEXTURE_{1D,2D,3D}, enum value, T data); boolean IsTexture(uint texture);
target: TEXTURE_{1D, 2D, 3D,RECTANGLE},
void CompressedTexSubImage2D( TEXTURE_{1D,2D}_ARRAY, TEXTURE_{1D, 2D}_ARRAY, Sampler Queries [6.1.5]
enum target, int level, int xoffset, TEXTURE_RECTANGLE, TEXTURE_CUBE_MAP{_ARRAY} TEXTURE_CUBE_MAP{_ARRAY} boolean IsSampler(uint sampler);
int yoffset, sizei width, sizei height, pname: TEXTURE_WRAP_{S, T, R}, TEXTURE_PRIORITY, value: TEXTURE_{RESIDENT, PRIORITY},
TEXTURE_{MIN, MAG}_FILTER, TEXTURE_LOD_BIAS, void GetSamplerParameter{if}v(
enum format, sizei imageSize, void *data); DEPTH_TEXTURE_MODE, GENERATE_MIPMAP, uint sampler, enum pname, T *params);
target: see TexSubImage2D TEXTURE_BORDER_COLOR, DEPTH_TEXTURE_MODE, TEXTURE_{BASE, MAX}_LEVEL,
format: see TexImage2D TEXTURE_{MIN, MAX}_LOD, GENERATE_MIPMAP, TEXTURE_BORDER_COLOR, TEXTURE_LOD_BIAS, void GetSamplerParameterI{i ui}v(
TEXTURE_SWIZZLE_{R, G, B, A, RGBA}, TEXTURE_COMPARE_{MODE, FUNC}, uint sampler, enum pname, T *params);
void CompressedTexSubImage1D( TEXTURE_{BASE, MAX}_LEVELS, TEXTURE_{MIN, MAG}_FILTER, pname: TEXTURE_WRAP_{S, T, R},
enum target, int level, int xoffset, sizei width, TEXTURE_COMPARE_{MODE, FUNC} [Table 3.16] TEXTURE_MAX_{LEVEL, LOD}, TEXTURE_MIN_LOD, TEXTURE_{MIN, MAG}_FILTER,
enum format, sizei imageSize, void *data); [Table 3.22] TEXTURE_SWIZZLE_{R, G, B, A, RGBA}, TEXTURE_BORDER_COLOR, TEXTURE_LOD_BIAS,
target: see TexSubImage1D TEXTURE_WRAP_{S, T, R} [Table 3.16, 3.22] TEXTURE_{MIN, MAX}_LOD,
format: see TexImage1D Cube Map Texture Selection [3.8.10][3.9.10] TEXTURE_COMPARE_{MODE, FUNC}
Enable/Disable( void GetTexLevelParameter{if}v(
TEXTURE_CUBE_MAP_SEAMLESS) enum target, int lod, enum value, T data);
(parameters )

Color Sum, Fog, and Hints Drawing, Reading, and Copying Pixels Whole Framebuffer
Color Sum [3.10] Reading Pixels [4.3.1] [4.3.2] void ReadBuffer(enum src); Operations
Enable/Disable(COLOR_SUM) void ReadPixels(int x, int y, sizei width, src: NONE, FRONT{_LEFT, RIGHT}, LEFT, RIGHT,
sizei height, enum format, enum type, BACK{_LEFT, RIGHT}, FRONT_AND_BACK, AUXi Selecting a Buffer for Writing [4.2.1]
Fog [3.11] void *data); (where i is [0, AUX_BUFFERS - 1 ]), void DrawBuffer(enum buf);
Enable/Disable(FOG) format: {COLOR, STENCIL}_INDEX, COLOR_ATTACHMENTi (where i is buf: NONE, FRONT, FRONT_{LEFT, RIGHT}, BACK,
void Fog{if}(enum pname, T param); DEPTH_{COMPONENT, STENCIL}, RED, GREEN, [0, MAX_COLOR_ATTACHMENTS - 1]) BACK_{LEFT, RIGHT}, LEFT, RIGHT,
BLUE, ALPHA, RG, RGB, RGBA, BGR, BGRA FRONT_AND_BACK, COLOR_ATTACHMENTi
void Fog{if}v(enum pname, T params); LUMINANCE{_ALPHA}, Copying Pixels [4.3.2] [4.3.3] (where i is [0, MAX_COLOR_ATTACHMENTS - 1 ]),
pname: FOG_MODE, FOG_COORD_SRC, FOG_DENSITY, {RED, GREEN, BLUE, ALPHA, RG, RGB, RGBA, BGR, void CopyPixels(int x, int y, sizei width, AUXi (where i is [0, AUX_BUFFERS - 1 ])
FOG_START, FOG_END, FOG_COLOR, FOG_INDEX void DrawBuffers(sizei n, const enum *bufs);
BGRA}_INTEGER [Table 3.3] [Table 3.6] sizei height, enum type);
Hints [5.8] type: BITMAP, {HALF_}FLOAT, {UNSIGNED_}BYTE, type: COLOR, STENCIL, DEPTH, DEPTH_STENCIL bufs: NONE, FRONT_{LEFT, RIGHT}, BACK_LEFT,
void Hint(enum target, enum hint); {UNSIGNED_}SHORT, {UNSIGNED_}INT, void BlitFramebuffer(int srcX0, int srcY0, BACK_RIGHT, COLOR_ATTACHMENTi (where i is
target: FRAGMENT_SHADER_DERIVATIVE_HINT, FLOAT_32_UNSIGNED_INT_24_8_REV, and the [0, MAX_COLOR_ATTACHMENTS - 1 ]), AUXi (where
int srcX1, int srcY1, int dstX0, int dstY0, i is [0, AUX_BUFFERS - 1 ])
TEXTURE_COMPRESSION_HINT, UNSIGNED_{BYTE, SHORT, INT}_* values from int dstX1, int dstY1, bitfield mask,
PERSPECTIVE_CORRECTION_HINT, [Table 3.2] [Table 3.5]
enum filter); Fine Control of Buffer Updates [4.2.2]
{LINE, POLYGON,POINT}_SMOOTH_HINT, Also see DrawPixels, ClampColor, and mask: Bitwise OR of
FOG_HINT, GENERATE_MIPMAP_HINT void IndexMask(uint mask);
PixelZoom in the Rasterization section {COLOR, DEPTH, STENCIL}_BUFFER_BIT
hint: FASTEST, NICEST, DONT_CARE of this reference card. filter: LINEAR, NEAREST void ColorMask(boolean r, boolean g,
boolean b, boolean a);
void ColorMaski(uint buf, boolean r,
Per-Fragment Operations void StencilOpSeparate(enum face,
enum sfail, enum dpfail, enum dppass);
void BlendFunc(enum src, enum dst);
srd, dst: see BlendFuncSeparate
boolean g, boolean b, boolean a);
Scissor Test [4.1.2] void DepthMask(boolean mask);
face: FRONT, BACK, FRONT_AND_BACK void BlendFunci(uint buf, enum src,
Enable/Disable(SCISSOR_TEST) sfail, dpfail, and dppass: KEEP, ZERO, REPLACE, INCR, void StencilMask(uint mask);
enum dst); void StencilMaskSeparate(enum face,
void Scissor(int left, int bottom, sizei width, DECR, INVERT, INCR_WRAP, DECR_WRAP srd, dst: see BlendFuncSeparate
sizei height ); func: NEVER, ALWAYS, LESS, LEQUAL, EQUAL, uint mask);
GREATER, GEQUAL, NOTEQUAL void BlendFuncSeparate(enum srcRGB, face: FRONT, BACK, FRONT_AND_BACK
Multisample Fragment Operations [4.1.3] enum dstRGB, enum srcAlpha,
Enable/Disable(target) Depth Buffer Test [4.1.5] [4.1.6] enum dstAlpha); Clearing the Buffers [4.2.3]
Enable/Disable(DEPTH_TEST) src, dst, srcRGB, dstRGB, srcAlpha, dstAlpha: ZERO, ONE, void Clear(bitfield buf);
target: SAMPLE_ALPHA_TO_{COVERAGE, ONE}, {SRC, DST, CONSTANT}_{COLOR, ALPHA},
SAMPLE_{COVERAGE, MASK}, MULTISAMPLE void DepthFunc(enum func); ONE_MINUS_ {SRC, DST, CONSTANT}_{COLOR, ALPHA}, buf: Bitwise OR of ACCUM_BUFFER_BIT,
func: see StencilOpSeparate SRC_ALPHA_SATURATE, {ONE_MINUS_}SRC1_ALPHA {COLOR, DEPTH, STENCIL}_BUFFER_BIT,
void SampleCoverage(clampf value, void ClearColor(clampf r, clampf g,
boolean invert); Occlusion Queries [4.1.6] [4.1.7] void BlendFuncSeparatei(uint buf, clampf b, clampf a);
void SampleMaski(uint maskNumber, BeginQuery(enum target, uint id); enum srcRGB, enum dstRGB, void ClearIndex(float index);
bitfield mask); EndQuery(enum target); enum srcAlpha, enum dstAlpha);
target: SAMPLES_PASSED, ANY_SAMPLES_PASSED dst, dstRGB, dstAlpha, src, srcRGB, srcAlpha: void ClearDepth(clampd d);
Alpha Test [4.1.4] see BlendFuncSeparate void ClearStencil(int s);
Enable/Disable(ALPHA_TEST) Blending [4.1.7] [4.1.8] void ClearAccum(float r, float g, float b,
Enable/Disable(BLEND) void BlendColor(clampf red, clampf green,
void AlphaFunc(enum func, clampf ref); clampf blue, clampf alpha); float a);
func: NEVER, ALWAYS, LESS,LEQUAL, EQUAL, GEQUAL, Enablei/Disablei(BLEND, uint index) void ClearBuffer{if ui}v(enum buffer,
GREATER, NOTEQUAL void BlendEquation(enum mode); Dithering [4.1.9] [4.1.10] int drawbuffer, const T *value)
Enable/Disable(DITHER) buffer: COLOR, DEPTH, STENCIL
Stencil Test [4.1.4] [4.1.5] void BlendEquationi(uint buf, enum mode); void ClearBufferfi(enum buffer,
Enable/Disable(STENCIL_TEST) void BlendEquationSeparate(enum modeRGB, Logical Operation [4.1.10] [4.1.11] int drawbuffer, float depth, int stencil);
void StencilFunc(enum func, int ref, enum modeAlpha); Enable/Disable(enum op) buffer: DEPTH_STENCIL
uint mask); mode, modeRGB, and modeAlpha: FUNC_ADD, op: INDEX_LOGIC_OP, LOGIC_OP, COLOR_LOGIC_OP drawbuffer: 0
FUNC_{SUBTRACT, REVERSE}_SUBTRACT, MIN, MAX void LogicOp(enum op);
void StencilFuncSeparate(enum face, op: CLEAR, AND, AND_REVERSE, COPY, Accumulation Buffer [4.2.4]
enum func, int ref, uint mask); void BlendEquationSeparatei(uint buf, enum
modeRGB, enum modeAlpha); AND_INVERTED, NOOP, OR, OR, NOR, EQUIV, void Accum(enum op, float value);
void StencilOp(enum sfail, enum dpfail, mode, modeRGB, and modeAlpha: see INVERT, OR_REVERSE, COPY_INVERTED, op: ACCUM, LOAD, RETURN, MULT, ADD.
enum dppass); BlendEquationSeparate OR_INVERTED, NAND, SET

©2010 Khronos Group - Rev. 0210 www.opengl.org/registry


OpenGL 4.00 API Quick Reference Card
Framebuffer Objects void RenderbufferStorage(enum target,
enum internalformat, sizei width,
textarget: TEXTURE_3D Framebuffer Object Queries [6.1.13] [6.1.19]
target and attachment: see FramebufferRenderbuffer boolean IsFramebuffer(uint framebuffer);
Binding and Managing [4.4.1] sizei height); void FramebufferTexture2D(enum target,
void BindFramebuffer(enum target, void GetFramebufferAttachmentParameteriv
target and internalformat: see enum attachment, enum textarget, (enum target, enum attachment,
uint framebuffer); RenderbufferStorageMultisample uint texture, int level); enum pname, int *params);
target: {DRAW, READ_}FRAMEBUFFER
Attaching Renderbuffer Images textarget: TEXTURE_{RECTANGLE, 3D}, target: {DRAW, READ_}FRAMEBUFFER
void DeleteFramebuffers(sizei n, TEXTURE_2D_MULTISAMPLE{_ARRAY}, attachment: FRONT_{LEFT, RIGHT}, BACK_{LEFT,RIGHT},
uint *framebuffers); void FramebufferRenderbuffer(enum target, TEXTURE_CUBE_MAP_{POSITIVE, NEGATIVE}_{X, Y, Z}
enum attachment, enum renderbuffertarget, COLOR_ATTACHMENTi, AUXi, DEPTH, STENCIL,
void GenFramebuffers(sizei n, uint *ids); target, attachment: see FramebufferRenderbuffer {DEPTH, STENCIL}_ATTACHMENT,
uint renderbuffer);
Attaching Images [4.4.2] target: {DRAW, READ_}FRAMEBUFFER void FramebufferTexture1D(enum target, DEPTH_STENCIL_ATTACHMENT
Renderbuffer Objects attachment: {DEPTH, STENCIL}_ATTACHMENT, enum attachment, enum textarget, pname: FRAMEBUFFER_ATTACHMENT_x (where x
void BindRenderbuffer(enum target, DEPTH_STENCIL_ATTACHMENT, uint texture, int level); may be OBJECT_TYPE, OBJECT_NAME, RED_SIZE,
uint renderbuffer); COLOR_ATTACHMENTi (where i is textarget: TEXTURE_1D GREEN_SIZE, BLUE_SIZE, ALPHA_SIZE, DEPTH_SIZE,
target: RENDERBUFFER [0, MAX_COLOR_ATTACHMENTS - 1]) target, attachment: see FramebufferRenderbuffer STENCIL_SIZE, COMPONENT_TYPE,
renderbuffertarget: RENDERBUFFER void FramebufferTextureLayer(enum target, COLOR_ENCODING, TEXTURE_LEVEL, LAYERED,
void DeleteRenderbuffers(sizei n, TEXTURE_CUBE_MAP_FACE, TEXTURE_LAYER)
const uint *renderbuffers); Attaching Texture Images enum attachment, uint texture,
void GenRenderbuffers(sizei n, void FramebufferTexture(enum target, int level, int layer); Renderbuffer Object Queries [6.1.14] [6.1.20]
enum attachment, uint texture, int level); target, attachment: see FramebufferTexture3D boolean IsRenderbuffer(uint renderbuffer);
uint *renderbuffers);
void RenderbufferStorageMultisample( target: {DRAW, READ_}FRAMEBUFFER Framebuffer Completeness [4.4.4] void GetRenderbufferParameteriv(
attachment: see FramebufferRenderbuffer enum CheckFramebufferStatus( enum target, enum pname, int *params);
enum target, sizei samples,
enum internalformat, sizei width, void FramebufferTexture3D(enum target, enum target); target: RENDERBUFFER
sizei height); enum attachment, enum textarget, target: {DRAW, READ_}FRAMEBUFFER pname: RENDERBUFFER_x (where x may be WIDTH,
target: RENDERBUFFER uint texture, int level, int layer); returns: FRAMEBUFFER_COMPLETE or a constant HEIGHT, INTERNAL_FORMAT, SAMPLES,
internalformat: see TexImage2DMultisample indicating the violating value {RED, GREEN, BLUE, ALPHA, DEPTH, STENCIL}_SIZE)
(parameters )

Special Functions void EvalPoint1(int p);


void EvalPoint2(int p, int q);
void PassThrough(float token); Synchronization
Evaluators [5.1] Timer Queries [5.1] [5.4] Flush and Finish [5.2] [5.6]
void Map1{fd}(enum target, T u1, T u2, Enumerated Query [6.1.3] void QueryCounter(uint id, TIMESTAMP); void Flush(void); void Finish(void);
int stride, int order, T points); void GetMap{ifd}v(enum map,
target: MAP1_VERTEX_{3,4}, MAP1_{INDEX, NORMAL}, enum value, T data); void GetInteger64v(TIMESTAMP, Sync Objects and Fences [5.3] [5.7]
MAP1_COLOR_4, MAP1_TEXTURE_COORD_{1,2,3,4} map: see target for Map1 int64 *data); sync FenceSync(enum condition, bitfield flags)
value: ORDER, COEFF, DOMAIN condition: SYNC_GPU_COMMANDS_COMPLETE
void Map2{fd}(enum target, T u1, T u2, Display Lists [5.5] flags: must be 0
int ustride, int uorder, T v1, T v2, Selection [5.2] void NewList(uint n, enum mode); void DeleteSync(sync sync);
int vstride, int vorder, T points); void InitNames(void); mode: COMPILE, COMPILE_AND_EXECUTE
target: see Map1, BUT replace MAP1 with MAP2 void PopName(void); void EndList(void); Waiting for Sync Objects [5.31] [5.7.1]
void EvalCoord{12}{fd}(T arg); enum ClientWaitSync(sync sync, bitfield flags,
void PushName(uint name); void CallList(uint n); uint64 timeout_ns);
void EvalCoord{12}{fd}v(T arg); void LoadName(uint name); void CallLists(sizei n, enum type, flags: SYNC_FLUSH_COMMANDS_BIT, or zero
void MapGrid1{fd}(int n, T u1, T u2); int RenderMode(enum mode); void *lists); void WaitSync(sync sync, bitfield flags,
void MapGrid2{fd}(int nu, T u1, T u2, mode: RENDER, SELECT, FEEDBACK type: BYTE, UNSIGNED_BYTE, SHORT, {2,3,4}_BYTES, uint64 timeout_ns);
int nv, T v1, T v2); void SelectBuffer(sizei n, uint *buffer); UNSIGNED_SHORT, INT, UNSIGNED_INT, FLOAT timeout_ns: TIMEOUT_IGNORED
void EvalMesh1(enum mode, int p1, int p2); Feedback [5.3] void ListBase(uint base); Sync Object Queries [6.1.8] [6.1.14]
mode: POINT, LINE void FeedbackBuffer(sizei n, enum type, uint GenLists(sizei s); void GetSynciv(sync sync, enum pname,
void EvalMesh2(enum mode, int p1, int p2, float *buffer); sizei bufSize, sizei *length, int *values);
boolean IsList(uint list); pname: OBJECT_TYPE, SYNC_{STATUS,CONDITION, FLAGS}
int q1, int q2); type: 2D, 3D, 3D_COLOR, 3D_COLOR_TEXTURE,
mode: FILL, POINT, LINE 4D_COLOR_TEXTURE void DeleteLists(uint list, sizei range); boolean IsSync(sync sync);

State and State Requests void GetDoublev(enum pname, double *data); Pointer & String Queries [6.1.6] [6.1.12]
void GetPointerv(enum pname,
ubyte *GetStringi(enum name, uint index);
name: EXTENSIONS
A complete list of symbolic constants for states void GetBooleani_v(enum target, uint index, index: range is [0, NUM_EXTENSIONS - 1]
is shown in the tables in [6.2]. boolean *data); void **params);
void GetIntegeri_v(enum target, uint index, pname: {SELECTION, FEEDBACK}_BUFFER_POINTER, Saving and Restoring State [6.1.21]
Simple Queries [6.1.1] int *data); {VERTEX, NORMAL, COLOR}_ARRAY_POINTER, void PushAttrib(bitfield mask);
void GetBooleanv(enum pname, {SECONDARY_COLOR, INDEX}_ARRAY_POINTER, mask: ALL_ATTRIB_BITS, or the bitwise OR of the
boolean *data); void GetInteger64i_v(enum target, {TEXTURE, FOG}_COORD_ARRAY_POINTER, attribute groups in [Table 6.3].
void GetIntegerv(enum pname, int *data); uint index, int64 *data); EDGE_FLAG_ARRAY_POINTER void PushClientAttrib(bitfield mask);
boolean IsEnabled(enum cap); mask: CLIENT_ALL_ATTRIB_BITS, or the bitwise OR of
void GetInteger64v(enum pname, ubyte *GetString(enum name); the attribute groups in [Table 6.3].
int64 *data); boolean IsEnabledi(enum target, uint index); name: RENDERER, VENDOR, VERSION,
void PopAttrib(void);
void GetFloatv(enum pname, float *data); SHADING_LANGUAGE_VERSION, EXTENSIONS
void PopClientAttrib(void);

The OpenGL® Shading Language is used to create [n.n.n] and [Table n.n] refer to sections and tables in Content shown in blue is removed from the OpenGL
shaders for each of the programmable processors the OpenGL Shading Language 4.00 specification 4.00 core profile and present only in the OpenGL 4.00
contained in the OpenGL processing pipeline. at www.opengl.org/registry compatibility profile.

Preprocessor [3.3] Preprocessor Directives


Each number sign (#) can be preceded in its
Operators and Expressions [5.1] 12. && logical and
Preprocessor Operators Numbered in order of precedence. Relational 13. ^^ logical exclusive or
line only by spaces or horizontal tabs. and equality operators > < <= >= == != evaluate
Preprocessor operators follow C++ standards. # #define #undef #if to Boolean. Compare vectors component-wise 14. || logical inclusive or
Preprocessor expressions are evaluated #ifdef #ifndef #else #elif with functions such as lessThan(), equal(), etc. Selects an entire operand. Use mix()
according to the behavior of the host processor, #endif #error #pragma #line 15. ?:
1. () parenthetical grouping to select indiv. components of vectors.
not the processor targeted by the shader. #extension #version #include = += -=
[] array subscript
#version 400 “#version 400” is required in shaders using version 4.00 of the language. Use ( ) function call & constructor structure 16.
*= /= assignment
2. %= <<= >>= arithmetic assignments
#version 400 profile profile to indicate core or compatibilty. if no profile specified, the default . field or method selector, swizzler
++ -- postfix increment and decrement &= ^= |=
is core.
++ -- prefix increment and decrement 17. , sequence
#extension • behavior: require, enable, warn, disable 3.
extension_name : behavior
+-~! unary
• extension_name: the extension supported by the compiler, or “all” Vector Components [5.5] In addition to
4. */% multiplicative
#extension all : behavior 5. +- additive array numeric subscript syntax, names of vector
6. << >> bit-wise shift components denoted by a single letter.
Predefined Macros 7. < > <= >= relational Components can be swizzled and replicated.
__LINE__ __FILE__ Decimal integer constants. FILE says which source string number is currently 8. == != equality {x, y, z, w} Vectors representing points or normals
being processed, or the path of the string if the string was an included string
9. & bit-wise and {r, g, b, a} Vectors representing colors
GL_compatibility_profile Integer 1 if the implementation supports the compatibility profile 10. ^ bit-wise exclusive or
__VERSION__ Decimal integer, e.g.: 400 11. | bit-wise inclusive or {s, t, p, q} Vectors representing texture coordinates

Aggregate Operations and Constructors Matrix Component Examples [5.6]


Examples of access components of a matrix with
Examples of operations on matrices and vectors:
m = f * m; // scalar * matrix component-wise
Matrix Constructor Examples [5.4] Array Constructor Example [5.4] array subscripting syntax: v = f * v; // scalar * vector component-wise
mat2(vec2, vec2); // 1 col./arg. float c[3] = float[3](5.0, b + 1.0, 1.1); mat4 m; // m is a matrix v = v * v; // vector * vector component-wise
mat2x3(vec2, float, vec2, float); // col. 2 m[1] = vec4(2.0); // sets 2nd col. to all 2.0 m = m +/- m; // matrix +/- matrix comp.-wise
dmat2(dvec2, dvec2); // 1 col./arg. Structure Constructor Example [5.4] m = m * m; // linear algebraic multiply
struct light {members; }; m[0][0] = 1.0; // sets upper left element to 1.0
dmat3(dvec3, dvec3, dvec3); // 1 col./arg. m[2][3] = 2.0; // sets 4th element of 3rd col. to 2.0 f = dot(v, v); // vector dot product
light lightVar = light(3.0, vec3(1.0, 2.0, 3.0)); v = cross(v, v); // vector cross product
©2010 Khronos Group - Rev. 0210 www.opengl.org/registry
OpenGL Shading Language 4.00 Quick Reference Card
Types [4.1.1-4.1.10] Floating-Point Sampler Types (Opaque) Unsigned Integer Sampler Types (Opaque) Aggregation of Basic Types
Transparent Types sampler[1,2,3]D 1D, 2D, or 3D texture usampler[1,2,3]D uint 1D, 2D, or 3D texture Arrays float[3] foo; float foo[3];
void no function return value samplerCube cube mapped texture • structures and blocks can be arrays
usamplerCube uint cube mapped texture • supports only 1-dimensional arrays
bool Boolean sampler2DRect rectangular texture • structure members can be arrays
usampler2DRect uint rectangular texture
int, uint signed/unsigned integers sampler[1,2]DShadow 1D,2D depth texture/
float single-precision floating- compare usampler[1,2]DArray 1D or 2D array texture Structures struct type-name {
point scalar sampler2DRectShadow rectangular texture/ usamplerBuffer uint buffer texture members
double double-precision floating comparison } struct-name[];
scalar sampler[1,2]DArray 1D or 2D array texture usampler2DMS uint 2D multi-sample texture // optional variable declaration,
vec2, vec3, vec4 floating point vector sampler[1,2]DArrayShadow 1D or 2D array depth usampler2DMSArray uint 2D multi-sample array tex. optionally an array
dvec2, dvec3, dvec4 double precision floating- texture/comparison usamplerCubeArray uint cube map array texture
point vectors Blocks in/out/uniform block-name {
samplerBuffer buffer texture
bvec2, bvec3, bvec4 Boolean vectors // interface matching by block name
sampler2DMS 2D multi-sample texture Implicit Conversions (All others must use constructors)
ivec2, ivec3, ivec4 signed and unsigned integer optionally-qualified members
uvec2, uvec3, uvec4 vectors sampler2DMSArray 2D multi-sample array tex. int -> uint } instance-name[];
mat2, mat3, mat4 2x2, 3x3, 4x4 float matrix samplerCubeArray cube map array texture int, uint -> float // optional instance name,optionally
mat2x2, mat2x3, 2-column float matrix of samplerCubeArrayShadow cube map array depth int, uint, float -> double an array
mat2x4 2, 3, or 4 rows texture with comparison ivec2|3|4 -> uvec2|3|4
mat3x2, mat3x3, 3-column float matrix of
mat3x4 2, 3, or 4 rows Integer Sampler Types (Opaque) ivec2|3|4 -> vec2|3|4
uvec2|3|4 -> vec2|3|4 Structure & Array Operations [5.7]
mat4x2, mat4x3, 4-column float matrix of isampler[1,2,3]D integer 1D, 2D, or 3D texture Select structure fields and the length()
mat4x4 2, 3, or 4 rows isamplerCube integer cube mapped texture vec2|3|4 -> dvec2|3|4 method of an array using the period (.)
dmat2, dmat3, dmat4 2x2, 3x3, 4x4 double- operator. Other operators include:
isampler2DRect int. 2D rectangular texture ivec2|3|4 -> dvec2|3|4 . field or method selector
precision float matrix
dmat2x2, dmat2x3, 2-col. double-precision float isampler[1,2]DArray integer 1D, 2D array texture uvec2|3|4 -> dvec2|3|4 == != equality
dmat2x4 matrix of 2, 3, 4 rows isamplerBuffer integer buffer texture mat2|3|4 -> dmat2|3|4 = assignment
dmat3x2, dmat3x3, 3-col. double-precision float isampler2DMS int. 2D multi-sample texture mat2x3|2x4 -> dmat2x3|2x4 [] indexing (arrays only)
dmat3x4 matrix of 2, 3, 4 rows mat3x2|3x4 -> dmat3x2|3x4
isampler2DMSArray int. 2D multi-sample array tex. Array elements are accessed using the
dmat4x2, dmat4x3, 4-column double-precision array subscript operator ( [ ] ), e.g.:
dmat4x4 float matrix of 2, 3, 4 rows isamplerCubeArray int. cube map array texture mat4x2|4x3 -> dmat4x2|4x3
diffuseColor += lightIntensity[3]*NdotL;

Qualifiers Layout Qualifiers [4.3.8]


layout(layout-qualifiers) block-declaration
Uniform-Block Layout Qualifiers
Layout qualifier identifiers for uniform blocks:
Precision and Precision Qualifiers [4.5]
Precision qualifiers have no effect on precision;
Storage Qualifiers [4.3] layout(layout-qualifiers) in/out/uniform shared, packed, std140, {row, column}_major, they aid code portability with OpenGL ES:
Declarations may have one storage qualifier.
layout(layout-qualifiers) in/out/uniform Interpolation Qualifier [4.3.9] highp, mediump, lowp
none (default) local read/write memory, or
input parameter declaration Qualify outputs from vertex shader and inputs to
fragment shader. Invariant Qualifiers Examples [4.6]
const compile-time constant, or read-only Input Layout Qualifiers #pragma STDGL invariant(all) force all output
function parameter For tessellation evaluation shaders: smooth perspective correct interpolation
flat no interpolation variables to be
in linkage into shader from previous stage triangles, quads, equal_spacing, isolines, invariant
centroid in linkage w/centroid based interpolation fractional_{even,odd}_spacing, cw, ccw, noperspective linear interpolation
invariant gl_Position; qualify a previously
sample in input linkage w/per-sample interpolation point_mode The following predeclared variables can be declared variable
out linkage out of a shader to next stage For geometry shader inputs: redeclared with an interpolation qualifier:
centroid out linkage w/centroid based interpolation invariant centroid out vec3 qualify as part of a
points, lines, {lines,triangles}_adjacency, Vertex language: Fragment language: Color; variable declaration
sample out output linkage w/per-sample interpolation triangles, invocations = integer-constant gl_FrontColor gl_Color
attribute ‡ linkage between a vertex shader and gl_BackColor gl_SecondaryColor
OpenGL for per-vertex data Input layout in fragment shaders only for
gl_FrontSecondaryColor
Precise Qualifier [4.7]
redeclaring built-in variable gl_FragCoord: Ensures that operations contributing to a
uniform linkage between a shader, OpenGL, and gl_BackSecondaryColor
origin_upper_left, pixel_center_integer variable’s value are executed in their stated
the application
varying ‡ linkage between a vertex shader and a Parameter Qualifiers [4.4] order and done with operator consistency.
Output Layout Qualifiers Requires two identical multiplies, followed by
centroid varying ‡ fragment shader for interpolated data For tessellation control shaders: Input values copied in at function call time, output
values copied out at function return time. an add.
vertices = integer-constant
patch in tessellation eval. shader input precise out vec4 Position = a * b + c * d;
For geometry shader outputs: none (default) same as in
patch out tessellation control shader output points, line_strip, triangle_strip, in for function parameters passed into function Order of Qualification [4.8]
‡ Qualifier is deprecated but not removed from core specification. max_vertices = integer-constant, When multiple qualifications are present, they
stream = integer-constant out for function parameters passed back out of
Uniform Qualifiers [4.3.5] function, but not initialized when passed in must follow this strict order:
Declare global variables with same values For fragment shaders:
inout for function parameters passed both into and precise invariant interpolation storage precision
across entire primitive processed. location = integer-constant, storage parameter precision
index = integer-constant out of a function
uniform vec4 lightPosition;

Statements and Structure Built-In Variables [7] Tessellation Control Language (cont’d) Geometry Language (cont’d)
Inputs:
Iteration and Jumps [6] Vertex Language Outputs:
out gl_PerVertex { in gl_PerVertex {
Function Call call by value-return Inputs: vec4 gl_Position; vec4 gl_Position;
Iteration for (;;) { break, continue } in int gl_VertexID; float gl_PointSize; float gl_PointSize;
in int gl_InstanceID; float gl_ClipDistance[];
while ( ) { break, continue } float gl_ClipDistance[]; (... also deprecated Vertex Language Outputs)
do { break, continue } while ( ); in vec4 gl_Color; (... also deprecated Vertex Language Outputs)
in vec4 gl_SecondaryColor; } gl_in[];
} gl_out[];
Selection if ( ) { } in vec3 gl_Normal; in int gl_PrimitiveIDIn;
if ( ) { } else { } in vec4 gl_Vertex; patch out float gl_TessLevelOuter[4]; in int gl_InvocationID;
switch ( ) { case integer: … break; … in vec4 gl_MultiTexCoordn // n is 0...7 patch out float gl_TessLevelInner[2];
in float gl_FogCoord; Outputs:
default: … } out gl_PerVertex {
Entry void main() Outputs: Tessellation Evaluation Language vec4 gl_Position;
out gl_PerVertex { Inputs: float gl_PointSize;
Jump break, continue, return vec4 gl_Position; in gl_PerVertex { float gl_ClipDistance[];
(There is no ‘goto’) (... also deprecated Vertex Language Outputs)
float gl_PointSize; vec4 gl_Position; };
Exit return in main() float gl_ClipDistance[]; float gl_PointSize;
discard // Fragment shader only vec4 gl_ClipVertex; float gl_ClipDistance[]; out int gl_PrimitiveID;
vec4 gl_FrontColor; (... also deprecated Vertex Language Outputs) out int gl_Layer;
Subroutines [6.1.2] vec4 gl_BackColor; } gl_in[gl_MaxPatchVertices];
Declare types with the subroutine keyword: vec4 gl_FrontSecondaryColor; Fragment Language
subroutine returnType subroutineTypeName(type0 in int gl_PatchVerticesIn;
arg0, type1 arg1, ..., typen argn);
vec4 gl_BackSecondaryColor; in int gl_PrimitiveID; Inputs:
vec4 gl_TexCoord[]; in vec3 gl_TessCoord; in vec4 gl_FragCoord;
Associate functions with subroutine types of float gl_FogFragCoord; patch in float gl_TessLevelOuter[4]; in bool gl_FrontFacing;
matching declarations by defining the functions }; patch in float gl_TessLevelInner[2]; in float gl_ClipDistance[];
with the subroutine keyword and a list of Outputs: in vec2 gl_PointCoord;
subroutine types the function matches: Tessellation Control Language in int gl_PrimitiveID;
out gl_PerVertex { in int gl_SampleID;
subroutine(subroutineTypeName0, ..., Inputs: vec4 gl_Position; in vec2 gl_SamplePosition;
subroutineTypeNameN) float gl_PointSize; in float gl_FogFragCoord;
returnType functionName(type0 arg0, type1 arg1, in gl_PerVertex {
vec4 gl_Position; float gl_ClipDistance[]; in vec4 gl_TexCoord[];
..., typen argn){ ... } // function body (... also deprecated Vertex Language Outputs) in vec4 gl_Color;
float gl_PointSize; }; in vec4 gl_SecondaryColor;
Declare subroutine type variables with a specific float gl_ClipDistance[];
subroutine type in a subroutine uniform variable (... also deprecated Vertex Language Outputs) Outputs:
declaration: } gl_in[gl_MaxPatchVertices];
Geometry Language out vec4 gl_FragColor;
subroutine uniform subroutineTypeName Inputs: out vec4 gl_FragData[gl_MaxDrawBuffers];
subroutineVarName; in int gl_PatchVerticesIn; in gl_PerVertex { out float gl_FragDepth;
Subroutine type variables are assigned to functions in int gl_PrimitiveID; vec4 gl_Position; out int gl_SampleMask[];
through commands (UniformSubroutinesuiv) in the in int gl_InvocationID; float gl_PointSize;
OpenGL API. (Continued >)
©2010 Khronos Group - Rev. 0210 www.opengl.org/registry
OpenGL Shading Language 4.00 Quick Reference Card
Built-In Variables (continued) Type Abbreviations for Built-in Functions: Tf=float, vecn. Td =double, dvecn. Tfd= float, vecn, double, dvecn.
Built-In Constants [7.3] Tb=bvecn, bool. Tvec=vecn, uvecn, ivecn. Tu=uint, uvecn. Ti=int, ivecn. Tui=int, ivecn, uint, uvecn.
The following built-in constants with minimum Use of Tn or Tnn within each function call must be the same. In vector types, n is 2, 3, or 4.
values are provided to all shaders. The actual
values used are implementation dependent, but
must be at least the value shown. Common Functions (continued) Geometric Functions [8.5] Integer Functions [8.8]
Tfd round(Tfd x) nearest integer, These functions operate on vectors as vectors, Component-wise operation. Tu=uint, uvecn.
const int gl_MaxTextureUnits = 2; implementation-dependent not component-wise. Tf=float, vecn. Td =double, Ti=int, ivecn. Tui=int, ivecn, uint, uvecn.
const int gl_MaxTextureCoords = 8; rounding mode dvecn. Tfd= float, vecn, double, dvecn. Tu uaddCarry (Tu x, Adds 32-bit uintx and y,
const int gl_MaxClipPlanes = 8; nearest integer, 0.5 rounds Tu y, out Tu carry) returning the sum modulo 232.
Tfd roundEven(Tfd x) float length(Tf x)
const int gl_MaxVertexAttribs = 16; to nearest even integer double length(Td x)
length of vector
Tu usubBorrow ( Subtracts y from x, returning
const int gl_MaxVertexUniformComponents = 1024;
const int gl_MaxVaryingFloats = 60; Tfd ceil(Tfd x) nearest integer >= x Tu x, Tu y, the difference if non-negative,
float distance(Tf p0, Tf p1) out Tu borrow) otherwise 232 plus the difference.
const int gl_MaxVaryingComponents = 60; Tfd fract(Tfd x) x - floor(x) distance between points
double distance(Td p0, Td p1)
const int gl_MaxVertexOutputComponents = 64; Tfd mod(Tfd x, Tfd y) void umulExtended (
const int gl_MaxGeometryInputComponents = 64; Tf mod(Tf x, float y) modulus float dot(Tf x, Tf y) Tu x, Tu y,
const int gl_MaxGeometryOutputComponents = 128; Td mod(Td x, double y) dot product out Tu msb,
double dot(Td x, Td y)
const int gl_MaxFragmentInputComponents = 128; separate integer and out Tu lsb, ) Multiplies 32-bit integers x and
const int gl_MaxVertexTextureImageUnits = 16; Tfd modf(Tfd x, out Tfd i) fractional parts vec3 cross(vec3 x, vec3 y)
cross product void imulExtended ( y, producing a 64-bit result.
const int gl_MaxCombinedTextureImageUnits = 80; dvec3 cross(dvec3 x, dvec3 y) Ti x, Ti y,
const int gl_MaxTextureImageUnits = 16; Tfd min(Tfd x, Tfd y)
Tf min(Tf x, float y) out Ti msb,
const int gl_MaxFragmentUniformComponents = 1024; Td min(Td x, double y) Tf normalize(Tf x) normalize vector to
const int gl_MaxDrawBuffers = 8; minimum value Td normalize(Td x) length 1 out Ti lsb, )
Tui min(Tui x, Tui y)
const int gl_MaxClipDistances = 8; Ti min(Ti x, int y) Extracts bits [offset, offset +
vec4 ftransform( ) invariant vertex transform Tui bitfieldExtract (
const int gl_MaxGeometryTextureImageUnits = 16; Tu min(Tu x, uint y) bits - 1] from value, returns them
Tui value, int
const int gl_MaxGeometryOutputVertices = 256; Tfd max(Tfd x, Tfd y) in the least significant bits of
const int gl_MaxGeometryTotalOutputComponents = 1024; Tfd faceforward(Tfd N, returns N if dot(Nref, I) < offset, int bits)
Tf max(Tf x, float y) the result.
const int gl_MaxGeometryUniformComponents = 1024; Td max(Td x, double y) Tfd I, Tfd Nref) 0, else -N
maximum value Tui bitfieldInsert ( Returns the insertion the bits
const int gl_MaxGeometryVaryingComponents = 64; Tui max(Tui x, Tui y)
Ti max(Ti x, int y) Tfd reflect(Tfd I, Tfd N) reflection direction I - 2 * Tui base, Tui insert, least-significant bits of insert
const int gl_MaxTessControlInputComponents = 128;
Tu max(Tu x, uint y) dot(N,I) * N int offset,int bits) into base.
const int gl_MaxTessControlOutputComponents = 128;
const int gl_MaxTessControlTextureImageUnits = 16; Tfd mix(Tfd x, Tfd y, Tfd a) Tui bitfieldReverse ( Returns the reversal of the bits
Tf mix(Tf x, Tf y, float a) linear blend of x and y Tfd refract(Tfd I, Tfd N, Tui value) of value.
const int gl_MaxTessControlUniformComponents = 1024; refraction vector
Td mix(Td x, Td y, double a) float eta)
const int gl_MaxTessControlTotalOutputComponents = 4096; Returns the number of bits
const int gl_MaxTessEvaluationInputComponents = 128; if comps. in a select Ti bitCount (Tui value)
Tfd mix(Tfd x, Tfd y, Tb a) true
comps. from y, else from x
set to 1.
const int gl_MaxTessEvaluationOutputComponents = 128; Returns bit number of least
const int gl_MaxTessEvaluationTextureImageUnits = 16; Matrix Functions [8.6] Ti findLSB (Tui value)
Tfd step(Tfd edge, Tfd x) For the matrix functions, type mat is used in significant bit.
const int gl_MaxTessEvaluationUniformComponents = 1024; Tf step(float edge, Tf x) 0.0 if x < edge, else 1.0
const int gl_MaxTessPatchComponents = 120; the single-precision floating point functions, Returns bit number of most
Td step(double edge, Td x) and type dmat is used in the double-precision Ti findMSB (Tui value)
const int gl_MaxPatchVertices = 32; significant bit.
Tb isnan(Tfd x) true if x is NaN floating point functions.
const int gl_MaxTessGenLevel = 64; N and M are 1, 2, 3, 4. Texture Lookup Functions [8.9]
Tb isinf(Tfd x) true if x is positive or See next page
negative infinity mat matrixCompMult(mat x, mat y)
Built-In Functions Tfd clamp(Tfd x, Tfd minVal, Tfd maxVal)
dmat matrixCompMult(dmat x, component-wise
multiply Fragment Processing Functions [8.10]
Angle & Trig. Functions [8.1] dmat y) Available only in fragment shaders.
Tf clamp(Tf x, float minVal, float maxVal)
Functions will not result in a divide-by-zero error. If the Td clamp(Td x, double minVal, min(max(x, Tf=float, vecn.
divisor of a ratio is 0, then results will be undefined. matN outerProduct(vecN c, vecN r) Derivative functions
double maxVal) minVal), outer product
Component-wise operation. Parameters specified Tui clamp(Tui x, Tui minVal, Tui maxVal) maxVal) dmatN outerProduct(dvecN c, (where N != M) Tf dFdx(Tf p) derivative in x
as angle are in units of radians. Tf=float, vecn. Ti clamp(Ti x, int minVal, int maxVal) dvecN r)
Tu clamp(Tu x, uint minVal, uint maxVal) Tf dFdy(Tf p) derivative in y
Tf radians(Tf degrees) degrees to radians
matNxM outerProduct(vecM c, vecN r) Tf fwidth(Tf p) sum of absolute derivative in
Tf degrees(Tf radians) radians to degrees Tfd smoothstep(Tfd edge0, dmatNxM outerProduct(dvecM c, outer product x and y
Tf sin(Tf angle) sine Tfd edge1, T x)
Tf smoothstep(float edge0, clip and dvecN r) Interpolation functions
Tf cos(Tf angle) cosine float edge1, Tf x) smooth Tf interpolateAtCentroid ( Return value of interpolant
Td smoothstep(double edge0, matN transpose(matN m)
Tf tan(Tf angle) tangent transpose Tf interpolant) sampled inside pixel and the
double edge1, Td x) dmatN transpose(dmatN m) primitive.
Tf asin(Tf x) arc sine
Returns signed int or uint matNxM transpose(matMxN m) Tf interpolateAtSample ( Return value of interpolant
Tf acos(Tf x) arc cosine Ti floatBitsToInt(Tf value) value representing the transpose
dmatNxM transpose(dmatMxN m) (where N != M) Tf interpolant, int at the location of sample
Tf atan(Tf y, Tf x) Tu floatBitsToInt(Tf value) encoding of a floating-point sample) number sample.
Tf atan(Tf y_over_x) arc tangent value.
float determinant(matN m) Tf interpolateAtOffset ( Return value of interpolant
Tf sinh(Tf x) hyperbolic sine Returns floating-point value of determinant Tf interpolant, sampled at fixed offset
Tf intBitsToFloat( double determinant(dmatN m)
Tui value) a signed int or uint encoding vec2 offset) offset pixel center.
Tf cosh(Tf x) hyperbolic cosine of a floating-point value.
matN inverse(matN m)
Tf tanh(Tf x) hyperbolic tangent Computes and returns a*b + c. inverse Noise Functions [8.11]
Tfd fma(Tfd a, Tfd b, dmatN inverse(dmatN m)
Tf asinh(Tf x) hyperbolic sine Tfd c) Treated as a single operation Returns noise value. Available to fragment,
when using precise. geometry, and vertex shaders.
Tf acosh(Tf x) hyperbolic cosine
Tfd frexp(Tfd x, out Splits x into a floating-point float noise1(Tf x)
Tf atanh(Tf x) hyperbolic tangent Ti exp) significand in the range [0.5, Vector Relational Functions [8.7]
1.0) and an int. exp. of 2. Compare x and y component-wise. Sizes of vecn noisen(Tf x) where n is 2, 3, or 4
Exponential Functions [8.2] the input and return vectors for any particular
Builds a floating-point number call must match. Tvec=vecn, uvecn, ivecn. Geometry Shader Functions [8.12]
Component-wise operation. Tf=float, vecn. Tfd ldexp(Tfd x, in Ti exp) from x and the corresponding
Tfd= float, vecn, double, dvecn. integral exponent of 2 in exp. bvecn lessThan(Tvec x, Tvec y) < Only available in geometry shaders.
Tf pow(Tf x, Tf y) xy void EmitStreamVertex( Emits values of output
Floating-Point Pack/Unpack [8.4] bvecn lessThanEqual(Tvec x, Tvec y) <= int stream) variables to the current
Tf exp(Tf x) ex output primitive stream
These do not operate component-wise.
Tf log(Tf x) ln bvecn greaterThan(Tvec x, Tvec y) > stream.
Converts each component
Tf exp2(Tf x) 2x uint packUnorm2x16(vec2 v) of v into 8- or 16-bit ints, void EndStreamPrimitive( Completes current output
uint packUnorm4x8(vec4 v) then packs results into the bvecn greaterThanEqual(Tvec x, Tvec y) >= int stream) primitive stream stream
Tf log2(Tf x) log2 uint packSnorm4x8(vec4 v) returned 32-bit unsigned and starts a new one.
Tfd sqrt(Tfd x) square root integer. bvecn equal(Tvec x, Tvec y) ==
bvecn equal(bvecn x, bvecn y) void EmitVertex() Emits values of output
Tfd inversesqrt(Tfd x) inverse square root vec2 unpackUnorm2x16 Unpacks 32-bit p into variables to the current
(uint p) two 16-bit uints, or four output primitive.
8-bit uints or signed bvecn notEqual(Tvec x, Tvec y) !=
Common Functions [8.3] vec4 unpackUnorm4x8 ints. Then converts each bvecn notEqual(bvecn x, bvecn y) void EndPrimitive() Completes output
Component-wise operation. See Type Abbreviations. (uint p) component to a normalized primitive and starts a
Tfd abs(Tfd x) absolute value vec4 unpackSnorm4x8 float to generate a 2- or true if any component of x
(uint p) bool any(bvecn x) new one.
Ti abs(Ti x) 4-component vector. is true
Tfd sign(Tfd x) returns -1.0, 0.0, or 1.0 Packs components of v into Shader Invocation Control [8.13]
Ti sign(Ti x) double packDouble2x32 a 64-bit value and returns a true if all components of x
(uvec2 v) bool all(bvecn x) Controls execution order of shader invocations.
Tfd floor(Tfd x) nearest integer <= x double-precision value. are true Available only to tessellation control shaders.
Tfd trunc(Tfd x) nearest integer with absolute uvec2 unpackDouble2x32 Returns a 2-component void barrier() Synchronizes across shader
value <= absolute value of x (double v) vector representation of v. bvecn not(bvecn x) logical complement of x invocations.

©2010 Khronos Group - Rev. 0210 www.opengl.org/registry


OpenGL Shading Language 4.00 Quick Reference Card
Texture Functions [8.9] Offset added before texture lookup as in texture. Projective texture lookup with explicit LOD.
See textureLod and textureOffset.
Texture lookup projectively, with gradient (continued)
Available to vertex, geometry, and fragment gvec4 textureOffset (gsampler1D sampler, float P, int offset gvec4 textureProjGrad(gsampler2DRect sampler, vec{3,4} P,
shaders. gvec4=vec4, ivec4, uvec4. [, float bias] ) gvec4 textureProjLod(gsampler1D sampler, vec{2,4} P, float vec2 dPdx, vec2 dPdy)
gsampler* =sampler*, isampler*, usampler*. gvec4 textureOffset (gsampler2D sampler, vec2 P, lod) float textureProjGrad(sampler2DRectShadow sampler,
Texture Query [8.9.1] ivec2 offset [, float bias] ) gvec4 textureProjLod(gsampler2D sampler, vec{3,4} P, float vec4 P, vec2 dPdx, vec2 dPdy)
gvec4 textureOffset (gsampler3D sampler, vec3 P, lod)
int textureSize(gsampler1D sampler, int lod) float textureProjGrad(sampler1DShadow sampler, vec4 P,
ivec3 offset [, float bias] ) gvec4 textureProjLod(gsampler3D sampler, vec4 P, float lod) float dPdx, float dPdy)
ivec2 textureSize(gsampler2D sampler, int lod) gvec4 textureOffset (gsampler2DRect sampler, vec2 P, float textureProjLod(sampler{1,2}DShadow sampler,
ivec3 textureSize(gsampler3D sampler, int lod) vec4 P, float lod) float textureProjGrad(sampler2DShadow sampler, vec4 P,
ivec2 offset ) vec2 dPdx, vec2 dPdy)
ivec2 textureSize(gsamplerCube sampler, int lod)
int textureSize(sampler1DShadow sampler, int lod) float textureOffset (sampler2DRectShadow sampler, Offset projective texture lookup with explicit LOD.
vec3 P, ivec2 offset ) See textureProj, textureLod, and textureOffset. Texture lookup projectively and with explicit gradient
ivec2 textureSize(sampler2DShadow sampler, int lod)
ivec2 textureSize(samplerCubeShadow sampler, int lod) float textureOffset (sampler1DShadow sampler, vec3 P, as in textureProjGrad, as well as with offset as in
int offset [, float bias] ) gvec4 textureProjLodOffset(gsampler1D sampler, vec{2,4}
ivec3 textureSize(samplerCubeArray sampler, int lod) P, float lod, int offset) textureOffset.
ivec3 textureSize(samplerCubeArrayShadow sampler, int lod) float textureOffset (sampler2DShadow sampler, vec3 P, gvec4 textureProjLodOffset(gsampler2D sampler, vec{3,4} gvec4 textureProjGradOffset(gsampler1D sampler,
ivec2 textureSize(gsampler2DRect sampler) ivec2 offset [, float bias] ) P, float lod, ivec2 offset) vec{2,4} P, float dPdx, float dPdy, int offset)
ivec2 textureSize(sampler2DRectShadow sampler) gvec4 textureOffset (gsampler1DArray sampler, vec2 P, gvec4 textureProjLodOffset(gsampler3D sampler, vec4 P, gvec4 textureProjGradOffset(gsampler2D sampler,
ivec2 textureSize(gsampler1DArray sampler, int lod) int offset [, float bias] ) float lod, ivec3 offset) vec{3,4} P, vec2 dPdx, vec2 dPdy, vec2 offset)
ivec3 textureSize(gsampler2DArray sampler, int lod) gvec4 textureOffset (gsampler2DArray sampler, vec3 P, float textureProjLodOffset(sampler1DShadow sampler,
ivec2 offset [, float bias] ) gvec4 textureProjGradOffset(gsampler2DRect sampler,
ivec2 textureSize(sampler1DArrayShadow sampler, int lod) vec4 P, float lod, int offset) vec{3,4} P, vec2 dPdx, vec2 dPdy, ivec2 offset)
ivec3 textureSize(sampler2DArrayShadow sampler, int lod) float textureOffset (sampler1DArrayShadow sampler, float textureProjLodOffset(sampler2DShadow sampler,
int textureSize(gsamplerBuffer sampler) vec3 P, int offset [, float bias] ) float textureProjGradOffset(sampler2DRectShadow
vec4 P, float lod, ivec2 offset) sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset)
ivec2 textureSize(gsampler2DMS sampler)
ivec2 textureSize(gsampler2DMSArray sampler) Use integer texture coordinate P to lookup a single Texture lookup as in texture but with explicit gvec4 textureProjGradOffset(gsampler3D sampler, vec4 P,
texel from sampler. gradients. vec3 dPdx, vec3 dPdy, vec3 offset)
vec2 textureQueryLod(gsampler1D sampler, float P)
vec2 textureQueryLod(gsampler2D sampler, vec2 P) gvec4 texelFetch(gsampler1D sampler, int P, int lod) gvec4 textureGrad(gsampler1D sampler, float P, float dPdx, float textureProjGradOffset(sampler1DShadow sampler,
gvec4 texelFetch(gsampler2D sampler, ivec2 P, int lod) vec4 P, float dPdx, float dPdy, int offset)
vec2 textureQueryLod(gsampler3D sampler, vec3 P) float dPdy)
vec2 textureQueryLod(gsamplerCube sampler, vec3 P) gvec4 texelFetch(gsampler3D sampler, ivec3 P, int lod) gvec4 textureGrad(gsampler2D sampler, vec2 P, vec2 dPdx, float textureProjGradOffset(sampler2DShadow sampler,
vec2 textureQueryLod(gsampler1DArray sampler, float P) vec2 dPdy) vec4 P, vec2 dPdx, vec2 dPdy, vec2 offset)
gvec4 texelFetch(gsampler2DRect sampler, ivec2 P)
vec2 textureQueryLod(gsampler2DArray sampler, vec2 P) gvec4 textureGrad(gsampler3D sampler, vec3 P, vec3 dPdx,
vec2 textureQueryLod(gsamplerCubeArray sampler, vec3 P) gvec4 texelFetch(gsampler1DArray sampler, ivec2 P, int lod) Texture Gather Instructions [8.9.3]
vec3 dPdy)
vec2 textureQueryLod(sampler1DShadow sampler, float P) gvec4 texelFetch(gsampler2DArray sampler, ivec3 P, int lod) gvec4 textureGrad(gsamplerCube sampler, vec3 P, Texture gather operation.
vec2 textureQueryLod(sampler2DShadow sampler, vec2 P) gvec4 texelFetch(gsamplerBuffer sampler, int P) vec3 dPdx, vec3 dPdy) gvec4 textureGather(gsampler2D sampler, vec2 P
vec2 textureQueryLod(samplerCubeShadow sampler, vec3 P) gvec4 texelFetch(gsampler2DMS sampler, ivec2 P, int sample) gvec4 textureGrad(gsampler2DRect sampler, vec2 P, [, int comp])
vec2 textureQueryLod(sampler1DArrayShadow sampler, vec2 dPdx, vec2 dPdy) gvec4 textureGather(gsampler2DArray sampler, vec3 P
float P) gvec4 texelFetch(gsampler2DMSArray sampler, ivec3 P,
float textureGrad(sampler2DRectShadow sampler, vec3 P, [, int comp])
vec2 textureQueryLod(sampler2DArrayShadow sampler, int sample)
vec2 P) vec2 dPdx, vec2 dPdy) gvec4 textureGather(gsamplerCube sampler, vec3 P
vec2 textureQueryLod(samplerCubeArrayShadow sampler, Fetch single texel as in texelFetch offset by offset as float textureGrad(sampler1DShadow sampler, vec3 P, [, int comp])
vec3 P) described in textureOffset. float dPdx, float dPdy) gvec4 textureGather(gsamplerCubeArray sampler,
gvec4 texelFetchOffset(gsampler1D sampler, int P, int lod, float textureGrad(sampler2DShadow sampler, vec3 P, vec4 P[, int comp])
Texel Lookup Functions [8.9.2] int offset) vec2 dPdx, vec2 dPdy) gvec4 textureGather(gsampler2DRect sampler, vec3 P
Use texture coordinate P to do a lookup in the gvec4 texelFetchOffset(gsampler2D sampler, ivec2 P, gvec4 textureGrad(gsampler1DArray sampler, vec2 P, [, int comp])
texture bound to sampler. int lod, ivec2 offset) float dPdx, float dPdy) vec4 textureGather(sampler2DShadow sampler, vec2 P,
gvec4 texture (gsampler1D sampler, float P [, float bias] ) gvec4 texelFetchOffset(gsampler3D sampler, ivec3 P, gvec4 textureGrad(gsampler2DArray sampler, vec3 P, float refZ)
gvec4 texture (gsampler2D sampler, vec2 P [, float bias] ) int lod, ivec3 offset) vec2 dPdx, vec2 dPdy)
vec4 textureGather(sampler2DArrayShadow sampler,
gvec4 texture (gsampler3D sampler, vec3 P [, float bias] ) gvec4 texelFetchOffset(gsampler2DRect sampler, ivec2 P, float textureGrad(sampler1DArrayShadow sampler, vec3 P, vec3 P, float refZ)
gvec4 texture (gsamplerCube sampler, vec3 P [, float bias] ) ivec2 offset) float dPdx, float dPdy)
vec4 textureGather(samplerCubeShadow sampler,
float texture (sampler{1D,2D}Shadow sampler, vec3 P gvec4 texelFetchOffset(gsampler1DArray sampler, ivec2 P, float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec3 P, float refZ)
[, float bias] ) int lod, int offset) vec2 dPdx, vec2 dPdy)
float texture (samplerCubeShadow sampler, vec4 P gvec4 textureGrad(gsamplerCubeArray sampler, vec4 P, vec4 textureGather(samplerCubeArrayShadow sampler,
[, float bias] ) gvec4 texelFetchOffset(gsampler2DArray sampler, ivec3 P, vec4 P, float refZ)
int lod, ivec2 offset) vec3 dPdx, vec3 dPdy)
gvec4 texture (gsampler1DArray sampler, vec2 P vec4 textureGather(sampler2DRectShadow sampler,
[, float bias] ) Texture lookup with both explicit gradient and offset, vec2 P, float refZ)
gvec4 texture (gsampler2DArray sampler, vec3 P Projective lookup as described in textureProj offset
[, float bias] ) by offset as described in textureOffset. as described in textureGrad and textureOffset.
Texture gather as in textureGather by offset as
gvec4 texture (gsamplerCubeArray sampler, vec4 P gvec4 textureProjOffset(gsampler1D sampler, vec{2,4} P, gvec4 textureGradOffset(gsampler1D sampler, float P, described in textureOffset except minimum and
[, float bias] ) int offset [, float bias]) float dPdx, float dPdy, int offset)
float texture (sampler1DArrayShadow sampler, vec3 P maximum offset values are given by
[, float bias] ) gvec4 textureProjOffset(gsampler2D sampler, vec{3,4} P, gvec4 textureGradOffset(gsampler2D sampler, vec2 P, {MIN, MAX}_PROGRAM_TEXTURE_GATHER_OFFSET.
ivec2 offset [, float bias]) vec2 dPdx, vec2 dPdy, ivec2 offset)
float texture (sampler2DArrayShadow sampler, vec4 P) gvec4 textureGatherOffset(gsampler2D sampler, vec2 P,
gvec4 texture (gsampler2DRect sampler, vec2 P) gvec4 textureProjOffset(gsampler3D sampler, vec4 P, gvec4 textureGradOffset(gsampler3D sampler, vec3 P, ivec2 offset [, int comp])
float texture (sampler2DRectShadow sampler, vec3 P) ivec3 offset [, float bias]) vec3 dPdx, vec3 dPdy, ivec3 offset)
gvec4 textureProjOffset(gsampler2DRect sampler, gvec4 textureGatherOffset(gsampler2DArray sampler,
float texture (gsamplerCubeArrayShadow sampler, vec4 P, gvec4 textureGradOffset(gsampler2DRect sampler, vec2 P, vec3 P, ivec2 offset [, int comp])
float compare) vec{3,4} P, ivec2 offset) vec2 dPdx, vec2 dPdy, ivec2 offset)
float textureProjOffset(sampler2DRectShadow sampler, gvec4 textureGatherOffset(gsampler2DRect sampler,
float textureGradOffset(sampler2DRectShadow sampler, vec3 P, ivec2 offset [, int comp])
Texture lookup with projection. vec4 P, ivec2 offset) vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset)
gvec4 textureProj (gsampler1D sampler, vec{2,4} P float textureProjOffset(sampler1DShadow sampler, vec4 P, float textureGradOffset(sampler1DShadow sampler, vec4 textureGatherOffset(sampler2DShadow sampler,
[, float bias] ) int offset [, float bias]) vec2 P, float refZ, ivec2 offset)
vec3 P, float dPdx, float dPdy, int offset)
gvec4 textureProj (gsampler2D sampler, vec{3,4} P float textureProjOffset(sampler2DShadow sampler, vec4 P, float textureGradOffset(sampler2DShadow sampler, vec4 textureGatherOffset(sampler2DArrayShadow
[, float bias] ) ivec2 offset [, float bias]) sampler, vec3 P, float refZ, ivec2 offset)
gvec4 textureProj (gsampler3D sampler, vec4 P [, float bias] ) vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset)
float textureProj (sampler{1D,2D}Shadow sampler, gvec4 textureGradOffset(gsampler1DArray sampler, vec2 P, vec4 vec2 textureGatherOffset(sampler2DRectShadow sampler,
Offset texture lookup with explicit LOD. P, float refZ, ivec2 offset)
vec4 P [, float bias] ) See textureLod and textureOffset. float dPdx, float dPdy, int offset)
gvec4 textureProj (gsampler2DRect sampler, vec{3,4} P)
gvec4 textureLodOffset(gsampler1D sampler, float P, gvec4 textureGradOffset(gsampler2DArray sampler, vec3 P, Texture gather as in textureGatherOffset except that
float textureProj (sampler2DRectShadow sampler, vec4 P) vec2 dPdx, vec2 dPdy, ivec2 offset)
float lod, int offset) offsets is used to determine the location of the four
Texture lookup as in texture but with explicit LOD. gvec4 textureLodOffset(gsampler2D sampler, vec2 P, float textureGradOffset(sampler1DArrayShadow sampler, texels to sample.
float lod, ivec2 offset) vec3 P, float dPdx, float dPdy, int offset)
gvec4 textureLod(gsampler1D sampler, float P, float lod) gvec4 textureGatherOffsets(gsampler2D sampler, vec2 P,
gvec4 textureLodOffset(gsampler3D sampler, vec3 P, float textureGradOffset(sampler2DArrayShadow sampler, ivec2 offset[4] [, int comp])
gvec4 textureLod(gsampler2D sampler, vec2 P, float lod) float lod, ivec3 offset) vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset)
gvec4 textureLod(gsampler3D sampler, vec3 P, float lod) gvec4 textureGatherOffsets(gsampler2DArray sampler,
float textureLodOffset(sampler1DShadow sampler, vec3 P, vec3 P, ivec2 offset[4] [, int comp])
gvec4 textureLod(gsamplerCube sampler, vec3 P, float lod) float lod, int offset) Texture lookup both projectively as in textureProj,
gvec4 textureGatherOffsets(gsampler2DRect sampler,
float textureLod(sampler{1D,2D}Shadow sampler, float textureLodOffset(sampler2DShadow sampler, vec3 P, and with explicit gradient as in textureGrad. vec3 P, ivec2 offset[4][, int comp])
vec3 P, float lod) float lod, ivec2 offset) gvec4 textureProjGrad(gsampler1D sampler, vec{2,4} P,
gvec4 textureLod(gsampler1DArray sampler, vec2 P, float lod) gvec4 textureLodOffset(gsampler1DArray sampler, vec2 P, float dPdx, float dPdy) vec4 textureGatherOffsets(sampler2DShadow sampler,
gvec4 textureLod(gsampler2DArray sampler, vec3 P, float lod) float lod, int offset) gvec4 textureProjGrad(gsampler2D sampler, vec{3,4} P, vec2 P, float refZ, ivec2 offset[4])
float textureLod(sampler1DArrayShadow sampler, gvec4 textureLodOffset(gsampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy) vec4 textureGatherOffsets(sampler2DArrayShadow
vec3 P, float lod) float lod, ivec2 offset) gvec4 textureProjGrad(gsampler3D sampler, vec4 P, sampler, vec3 P, float refZ, ivec2 offset[4])
gvec4 textureLod (gsamplerCubeArray sampler, vec4 P, float textureLodOffset(sampler1DArrayShadow sampler, vec3 dPdx, vec3 dPdy) vec4 textureGatherOffsets(sampler2DRectShadow
float lod) vec3 P, float lod, int offset) (more ) sampler, vec2 P, float refZ, ivec2 offset[4])

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.

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

Potrebbero piacerti anche