The
pass-through shader shows the basic structure of a geometry shader but it
doesn’t really do anything exciting.
Let’s
modify it to make a duplication shader, which will duplicate an object and
translate it by a vector.
First,
let’s change the vertex shader so that it passes through the vertex
positions. We’ll apply the modelview and
projection matrices to compute
gl_Position in
the
geometry shader
instead.
Vertex shader:

In
the geometry shader, we’ll duplicate each triangle and apply a translation.
Geometry shader:

Result: