Let’s consider a simple pass-through
geometry shader, which doesn’t actually do anything other than pass through
the vertex shader to the
In shader code:
- vColourPass and vTexCoordPass
in from the vertex shader.
- Variables that are out for the vertex
input to the geometry shader, since the geometry shader will have access to all
vertices on the primitive.
The geometry shader will output a vColour and
the fragment shader.
- The layout of the input primitive is a
triangle (of any type).
- The layout of the output primitive is a
triangle strip consisting of a maximum of three vertices. OpenGL uses the maximum number of vertices to
allocate internal arrays.
each vertex in the primitive, the code of main():
- Sets gl_Position
- Passes the colour from the vertex shade
- Passes the texture coordinate from the
- Emits the vertex. This will complete processing for this vertex
- Calls EndPrimitive to
let OpenGL know we’re done with this primitive