Chapter 4. Fragment Shaders

Fragment shaders are probably the most important type of shaders of all. They are so important that a casual reader would understand them simply as shaders.

Using fragment shaders is the only way of painting something on the screen. They are responsible for updating the framebuffer with colors and depth; so, in short, in the last term, all that you see on the screen is painted by a fragment shader.

In this chapter we will learn how fragment shaders are executed, what they can do, and what they can't. Also, we will see how fragment shaders interact with other pipeline stages.

Execution model

When a primitive stage has ended, its processing in the vertex primitive stages (vertex shaders, geometry shaders, and clipping) becomes ...

Get GLSL Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.