From three vertices to every pixel

The vertex shader runs once per vertex. The rasterizer then works out which pixels the triangle covers and blends each vertex's outputs for them. The fragment shader runs once for every one of those pixels. Drag the vertices, shrink the image, and hover a pixel.

Vertex colors (a_color)

Vertex shader

Runs 3 times, once per vertex. Each run turns the vertex's attributes into a clip-space position.

Runa_positiona_colorgl_Position.xy

Rasterizer

Finds the pixels whose centers fall inside the triangle and blends the vertex shader's out values for each. Fragments created: .

Fragment shader

Runs once per covered pixel. The values it receives are blended, not copied from a vertex.