OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition
by Dave Shreiner, Graham Sellers, John M. Kessenich, Bill M. Licea-Kane
In/Out Blocks
Shader variables output from one stage and input into the next stage can also be organized into interface blocks. These logical groupings can make it easier to visually verify interface matches between stages, as well as to make linking separate programs easier.
For example, a vertex shader might output:
out Lighting { vec3 normal; vec2 bumpCoord;};
This would match a fragment shader input:
in Lighting { vec3 normal; vec2 bumpCoord;};
A vertex shader might output material and lighting information, each grouped into its own block. The interfaces built into the OpenGL Shading Language are also organized into blocks, like gl_PerVertex, which contains the built-in variable gl_Position, among others. A complete list of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access