glsl限定符
Attribute
Vertex attribute data.
Example
attribute vec4 v_color;
Description
attribute read-only variables containing data shared from WebGL/OpenGL environment to the vertex shader.
Because the vertex shader is executed one time for each vertex, attributes are specify per vertex data typically with information such as: space position, color, normal direction and texture coordinates of a vertex.
Const
Constant qualifier
Example
const float PI = 3.14159265359;
Description
const qualifier can be applied to the declaration of any variable to specify that its value will not be changed.
Uniform
Uniform variable qualifier.
Example
uniform vec4 direction;
Description
uniform variables contain read-only data shared from WebGL/OpenGL environment to a vertex or fragment shader.
The value is per primitive, so is useful for variables which remain constant along a primitive, frame or scene.
Varying
Varying variable qualifier.
Example
varying vec3 position;
Description
varying variables contain data shared from a vertex shader to a fragment shader.
The variable must be written in the vertex shader and the read-only value in the fragment shader is then interpolated from the vertices which make up the fragment.