If you really "want to specify the color within the fragment shader", this is your fragment shader:
precision mediump float;
void main(void) {
gl_FragColor = vec4 (0.0, 1.0, 0.0, 1.0);
}
This would give you green (values in the vec4()
are r, g, b, a). Of course, in this case you can eliminate all the color stuff under the heading "Define the vertices' colors" in the tutorial.