Graphics Reference
In-Depth Information
Uniforms
Samplers
Input (Attribute) 0
Input (Attribute) 1
Input (Attribute) 2
Input (Attribute) 3
Input (Attribute) 4
Output (Varying) 0
Output (Varying) 1
Output (Varying) 2
Output (Varying) 3
Output (Varying) 4
Vertex Shader
...
...
Input (Attribute) N
Output (Varying) N
gl_Position
gl_PointSize
Figure 8-2
OpenGL ES 3.0 Vertex Shader
The built-in variables of a vertex shader can be categorized into special
variables that are input or output of the vertex shader, uniform state
such as depth range, and constants that specify maximum values such as
the number of attributes, number of vertex shader output variables, and
number of uniforms.
Built-In Special Variables
OpenGL ES 3.0 has built-in special variables that serve as inputs to the
vertex shader, or outputs by the vertex shader that then become inputs
to the fragment shader, or outputs by the fragment shader. The following
built-in special variables are available to the vertex shader:
•
gl_VertexID
is an input variable that holds an integer index for the
vertex. This integer variable is declared using the
highp
precision qualifier.
•
gl_InstanceID
is an input variable that holds the instance number of
a primitive in an instanced draw call. Its value is
0
for a regular draw
call.
gl_InstanceID
is an integer variable declared using the
highp
precision qualifier.