Depth buffer
Also called: Z-buffer
Related terms: depth test, Z-fighting
A hidden image the same size as the screen. Each pixel stores the distance to the nearest surface drawn there so far. Before a new fragment is written, its distance is compared. If something closer is already there, the fragment is thrown away.
This lets objects be drawn in any order. When two surfaces sit at almost the same depth they flicker, which is called Z-fighting.
- Further reading
- LearnOpenGL: depth testing