The fragment shader is called from every pixel in the primitives drawn to the screen.
141 // The fragment shader can be thought of for now as doing per pixel computations. It is the 142 // fragment shader the colors each pixel in a 3d scene. 143 var fragmentShaderSource = "precision mediump float;" 144 + "" 145 + "void main()" 146 + "{" 147 + " gl_FragColor = vec4(0.8,0.3,0.3,1);" 148 + "}";
The output of the fragment shader is the 4-vector gl_FragColor containing the r,g,b,α color of the pixel. This example sets a constant color. Later examples will show how to pass variables into the fragment shader and use them to compute the color.
0.8,0.3,0.3,1 is an opaque dark red.