2,561
edits
m (→Varyings) |
|||
Line 294: | Line 294: | ||
== Varyings == | == Varyings == | ||
An interface between vertex and fragment shaders is provided by varying variables: vertex shaders compute values per vertex and fragment shaders compute values per fragment. | |||
The value of a varying variable defined in a vertex shader, will be interpolated (perspective-correct) over the primitve being rendered and the interpolated value in the fragment shader can be accessed. | |||
Varying variables can only be used with the data types float, vec2, vec3, vec4, mat2, mat3, mat4. (and arrays of them too.) | |||
* varying vec4 gl_FrontColor // vertex | * varying vec4 gl_FrontColor // vertex | ||
* varying vec4 gl_BackColor; // vertex | * varying vec4 gl_BackColor; // vertex |
edits