A fragment shader is a tiny program that runs once for every pixel on your screen, deciding what color that pixel should be. You set the output color using gl_FragColor, which takes red, green, blue, and alpha values from 0.0 to 1.0. This tutorial starts with the simplest possible shader — painting every pixel the same solid color. It is the "Hello World" of GPU programming and the foundation for everything that follows.
Key Concepts
gl_FragColor
vec3 / vec4 color
precision qualifier
Try this shader live in the Shader Sandbox editor with real-time preview.