Game Development Reference
In-Depth Information
varying float v_r;
varying float v_g;
varying float v_b;
void main() {
v_r = red;
v_g = green;
v_b = blue;
// Set the position of each vertex
gl_Position = u_projectionMatrix * a_position;
}
The only two things the preceding vertex shader does are pass our values from CSS
to the fragment shader and set the vertex position of each vertex on our content
mesh.
//
----------------------------------------------------
// Vertex shader: simple-vert-shader.glsl
//
----------------------------------------------------
precision mediump float;
// Input from vertex shader
varying float v_r;
varying float v_g;
varying float v_b;
void main() {
// Set the color of each fragment
css_ColorMatrix = mat4(v_r, 0.0, 0.0, 0.0,
0.0, v_g, 0.0, 0.0,
0.0, 0.0, v_b, 0.0,
Search WWH ::




Custom Search