March 2013
Intermediate to advanced
984 pages
26h 18m
English
In the beginning of the section, we mentioned reading and writing structured data. If all you had was an array of vec4, you probably could get by with using image buffers. However, if you really have a collection of structured objects, where each is a heterogeneous collection of types, image buffers would become quite cumbersome. With shader storage buffers, however, you get full use of GLSL structure definitions and arrays to define the layout of your buffer. See the example in Example 11.7 to get the idea.
Example 11.7. Declaration of Structured Data
#version 430 core// structure of a single data itemstruct ItemType { int count; vec4 data[3]; // ... other fields};// declare a buffer ...