Graphics Reference
In-Depth Information
•
gl_Position
is used to output the vertex position in clip coordinates.
Its values are used by the clipping and viewport stages to perform
appropriate clipping of primitives and to convert the vertex position
from clip coordinates to screen coordinates. The value of
gl_Position
is undefined if the vertex shader does not write to
gl_Position
.
gl_Position
is a floating-point variable declared using the
highp
precision qualifier.
•
gl_PointSize
is used to write the size of the point sprite in pixels.
It is used when point sprites are rendered. The
gl_PointSize
value output by a vertex shader is then clamped to the aliased
point size range supported by the OpenGL ES 3.0 implementation.
gl_PointSize
is a floating-point variable declared using the
highp
precision qualifier.
•
gl_FrontFacing
is a special variable that, although not directly
written by the vertex shader, is generated based on the position values
generated by the vertex shader and primitive type being rendered.
gl_FrontFacing
is a boolean variable.
Built-In Uniform State
The only built-in uniform state available inside a vertex shader is the
depth range in window coordinates. This is given by the built-in uniform
name
gl_DepthRange
, which is declared as a uniform of type
gl_DepthRangeParameters
.
struct gl_DepthRangeParameters
{
highp float near; // near Z
highp float far; // far Z
highp float diff; // far - near
}
uniform gl_DepthRangeParameters gl_DepthRange;
Built-In Constants
The following built-in constants are also available inside the vertex
shader:
const mediump int gl_MaxVertexAttribs = 16;
const mediump int gl_MaxVertexUniformVectors = 256;
const mediump int gl_MaxVertexOutputVectors = 16;
const mediump int gl_MaxVertexTextureImageUnits = 16;
const mediump int gl_MaxCombinedTextureImageUnits = 32;