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
Geometry Shader Instancing
One type of instancing has already been covered in Chapter 3. In this first type of instancing, functions like glDrawArraysInstanced() or glDrawElementsInstanced() are used to simply run the whole OpenGL pipeline on a set of input data multiple times. This results in the vertex shader running several times on all of the input vertices, with the same vertex data being fetched from memory for each instance of the draw. Also, if tessellation is active, primitives will be tessellated multiple times, resulting in a potentially huge processing load for the GPU. To differentiate between members of each instance in the shader, the built-in GLSL variable gl_InstanceID is provided. Another type of instancing, known as geometry ...
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