-
Uniforms are the same for all vertces
-
Queried by glGetUniformLocation()
-
Set by glUniform*()
-
Apply to both vertices and fragments
-
Denoted by the uniform type modifier
-
The value of uniform is constant in the shader code
-
Uniforms are usefull to pass:
|
-
#version 130
in vec4 vPosition;
in vec4 vNormal;
uniform mat4 mM;
uniform mat4 mV;
uniform mat4 mP;
uniform mat4 mRotations;
uniform vec4 vLight;
void main () {
/*rotate normals...*/
/*if rotating camera, rotate light
direction as well...*/
// Go model to world, then to camera,
//then to NDC coordinates:
gl_Position = mP * mV * mM * vPosition;
}
|