May 2017
Intermediate to advanced
982 pages
22h 42m
English
The GLSL supports functions that are syntactically similar to C functions. However, the calling conventions are somewhat different. In the following example, we'll revisit the ADS shader using functions to help provide abstractions for the major steps.
As with previous recipes, provide the vertex position at attribute location 0 and the vertex normal at attribute location 1. Uniform variables for all of the ADS coefficients should be set from the OpenGL side, as well as the light position and the standard matrices.
To implement ADS shading using functions, use the following code:
layout (location = 0) in vec3 VertexPosition; layout (location = 1) in vec3 VertexNormal; ...
Read now
Unlock full access