Using uniform variables with shaders
Uniform variables present a way to pass variables from the application into GLSL shaders. However, you are limited to pass numerical values, vectors, and matrices only.
The dynamic rendering pipeline doesn't use immediate mode functions to set up vertices or matrices. This means functions such as gl.Vertex
, gl.Rotate
, gl.Translate
, and gl.Scale
are of no use anymore. For this situation, vertices are stored in vertex buffers. Other variables such as model view and projection matrix have to be supplied by uniform variables. These variables are also used often to set up or change the behavior of the shader program during runtime. For example, you can adjust the glowing effect amount in your shader program.
Getting ready
Each uniform variable has its own numerical location identifier. This identifier is used to access almost any uniform variable. The location identifier is limited to primitive values such as integer, float, and vectors. Matrices present...