beginner

#1 Hello World

Output a solid color

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

Try this shader live in the Shader Sandbox editor with real-time preview.
Open in Sandbox

Source Code


    
Next → UV Coordinates

All Tutorials