September 2018
Intermediate to advanced
472 pages
15h 36m
English
A uniform block can have an optional instance name. For example, with our BlobSettings block, we could have used the instance name Blob, as shown here:
uniform BlobSettings {
vec4 InnerColor;
vec4 OuterColor;
float RadiusInner;
float RadiusOuter;
} Blob;
In this case, the variables within the block are placed within a namespace qualified by the instance name. Therefore, our shader code needs to refer to them prefixed with the instance name. For example:
FragColor = mix( Blob.InnerColor, Blob.OuterColor, smoothstep( Blob.RadiusInner, Blob.RadiusOuter, dist ) );
Additionally, we need to qualify the variable names (with the BlobSettings block name) within the OpenGL code when querying for variable ...
Read now
Unlock full access