OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition
by Dave Shreiner, Graham Sellers, John M. Kessenich, Bill M. Licea-Kane
Producing Primitives
Primitives are produced in the geometry shader with the two special built-in functions, EmitVertex() and EndPrimitive(). As already discussed, a single geometry shader invocation must call EmitVertex() and possibly EndPrimitive() to produce output primitives. If the geometry shader does not call these functions, no output geometry is produced, and the inputs to the shader are essentially discarded. This is culling. On the other hand, if the geometry shader calls EmitVertex() many times, it can produce more output than it receives at its input, amplifying the geometry.
Another unique feature of geometry shaders is that they can have a different primitive type for their output than they do for their input. This can be used ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access