March 2013
Intermediate to advanced
984 pages
26h 18m
English
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 ...