
76 IDiscovering
taken by the structure and update the explicit locations of the others structures ac-
cordingly. This works, but it is not an effective way to code. Listings 5.10 and 5.11
illustrate that GLSL doesn’t provide any operator to help us in counting the number
of locations of a structure.
Tip
– Use structures...but only within blocks!
5.4.6 Linked and Separated Programs
From the beginning, GLSL has had a very different programming model than HLSL,
Cg, or even the old assembly-like OpenGL programs [Brown 02, Lipchak 2002]. In
those environments, each shader stage is independent This approach follows very well
the way a graphics programmer designs ...