Appendix L. std140 Uniform Buffer Layout

This appendix describes the layout of the members of a uniform buffer object when the layout is specified with the layout modifier std140. It has the following major sections:

Using the std140 Layout Qualifier

Generally, when you group a number of uniform variables in a uniform buffer object, you need to query the offset (and format and type, if you don’t know those values from the shader source). For large collections of uniforms, this process can result in needed to make many queries. The std140 layout qualifier requests that the GLSL shader compiler organize the variables in uniform block according to a set of rules, ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Versions 3.0 and 3.1, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.