March 2013
Intermediate to advanced
984 pages
26h 18m
English
To access a collection of uniform variables using routines such as glMapBuffer() (see Chapter 3, “Drawing with OpenGL” for more details), you need to slightly modify their declaration in your shader. Instead of declaring each uniform variable individually, you group them, just as you would do in a structure, in a uniform block. A uniform block is specified using the uniform keyword. You then enclose all the variables you want in that block within a pair of braces, as demonstrated in Example 2.3.
Example 2.3. Declaring a Uniform Block
uniform Matrices { mat4 ModelView; mat4 Projection; mat4 Color;};
Recall types are divided into two categories: opaque and transparent; where the opaque types include ...