March 2013
Intermediate to advanced
984 pages
26h 18m
English
Reading data from and writing data to memory using image variables works well for simple cases where large arrays of homogeneous data are needed, or where the data is naturally image-based (such as the output of OpenGL rendering or where the shader is writing into an OpenGL texture). However, in some cases, large blocks of structured data may be required. For these use cases, we can use a buffer variable to store the data. Buffer variables are declared in shaders by placing them in an interface block which in turn is declared using the buffer keyword. A simple example is given in Example 11.5.
Example 11.5. Simple Declaration of a Buffer Block
#version 430 core// create a readable-writeable ...