OpenGL ES 3.0 Vertex coloring tool (2), opengles
# Version 300 esuniform mat4 u_mvpMatrix; in vec4 a_position; in vec4 a_color;
Out vec4 v_color;
Void main () {v_color = a_color; gl_Position = u_mvpMatrix * a_position ;}
The above is a piece of vertex coloring code.
# Version 300 es
The first line in the vertex coloring file indicates that the color language version is 3.0 (shading language 3.0)
Uniform mat4 u_mvpMatrix;
Create an uniform variable u_mvpMatrix for storing the projection matrix of the composite model view.
In vec4 a_position; in vec4 a_color;
Input to the vertex shader as the attribute of the vertex shader.
A_position is the position attribute of the input vertex, and a_color is the color attribute of the input vertex.
Out vec4 v_color;
Output vertex color
Gl_position is a built-in automatic declaration variable, and the colorant must write the transformed position and pass it to it.
Void main is the entry point of a vertex or fragment shader.
V_color = a_color;
We read the vertex attribute input a_color and write its vertex color output v_color.
Gl_Position = u_mvpMatrix * a_position;
Use gl_Position to change the vertex position.