Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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
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.
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.
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