March 2013
Intermediate to advanced
984 pages
26h 18m
English
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 ...