Graphics Reference
In-Depth Information
The outputs of the vertex shader were called varying variables in OpenGL
ES 2.0, but were renamed vertex shader output variables in OpenGL ES
3.0. In the primitive rasterization stage, the vertex shader output values
are calculated for each generated fragment and are passed in as inputs to
the fragment shader. The mechanism used to generate a value for each
fragment from the vertex shader outputs that is assigned to each vertex
of the primitive is called interpolation. Additionally, OpenGL ES 3.0 adds
a new feature called transform feedback, which allows the vertex shader
outputs to be selectively written to an output buffer (in addition to, or
instead of, being passed to the fragment shader). For example, as covered
in the transform feedback example in Chapter 14, a particle system can be
implemented in the vertex shader in which particles are output to a buffer
object using transform feedback. The inputs and outputs of the vertex
shader are shown in Figure 1-2.
Uniforms
Samplers
Input (Attribute) 0
Output (Varying) 0
Input (Attribute) 1
Output (Varying) 1
Input (Attribute) 2
Output (Varying) 2
Vertex Shader
Input (Attribute) 3
Output (Varying) 3
Input (Attribute) 4
Output (Varying) 4
...
...
Output (Varying) N
Input (Attribute) N
gl_Position
gl_PointSize
Figure 1-2
OpenGL ES 3.0 Vertex Shader
Vertex shaders can be used for traditional vertex-based operations such as
transforming the position by a matrix, computing the lighting equation
to generate a per-vertex color, and generating or transforming texture
 
Search WWH ::




Custom Search