Depth buffer 2026-11-05
A depth buffer stores a depth value for each covered framebuffer sample so that rasterization can resolve visibility. With the common “less” comparison, a new fragment contributes only when its depth is smaller than the stored value; an accepted fragment can then update that value. Thus the nearest opaque surface can win even when primitives arrive in a different order.[ref]
For example, starting from depth 1, an opaque fragment at 0.7 passes, then one at 0.2 replaces it; a later fragment at 0.8 fails. Reversing the first two arrivals gives the same visible surface. Finite precision can make nearly coincident surfaces compare inconsistently. Transparent surfaces also require additional treatment: selecting one nearest depth alone cannot combine light from several layers.
Fragment shader 2026-11-05
A fragment shader is a programmable stage of the rasterization pipeline that computes values for a fragment, such as its output color and optionally its depth. It receives interpolated data from rasterized primitives and can use texture mapping to sample an image. A fragment is a candidate contribution; later tests and blending determine what reaches the final digital image.[ref]
The OpenGL Graphics System Version 4.6 Core Profile by Khronos Group. Chapter 15, Fragment Shaders; Chapter 17, per-fragment operations
For example, a shader can multiply a surface's interpolated color by a sampled image to decorate a triangle. A fragment hidden behind a nearer opaque surface may fail the depth buffer test. With multiple samples per pixel, fragments, shader invocations and final pixels need not correspond one to one.
Khronos Group 2026-11-05
The Khronos Group publishes interoperability specifications for graphics and related computational interfaces. Its OpenGL specification defines a rendering pipeline, including rasterization, fragment shaders and per-fragment operations. A specification makes observable behavior portable across implementations: for example, a configured depth buffer comparison determines whether a candidate surface contributes to the framebuffer. This is a definition of an interface contract, rather than a requirement that all implementations use identical internal hardware.[ref]
https://www.khronos.org/about/. Organizational description and open interoperability standards
[ref]The OpenGL Graphics System Version 4.6 Core Profile by Khronos Group. Chapters 14, 15 and 17
OpenGL 2026-11-05
OpenGL is a graphics programming interface that specifies commands, data objects and rendering behavior independently of a particular graphics processor. An application supplies geometric primitives and programs for programmable stages; the implementation transforms, rasterizes and combines their contributions into a framebuffer. Khronos Group publishes the specification, including the distinction between core and compatibility profiles.[ref]
The OpenGL Graphics System Version 4.6 Core Profile by Khronos Group. Chapter 2, OpenGL Fundamentals; Chapter 11, Programmable Vertex Processing
For example, drawing an opaque triangle requires vertex data, appropriate shader programs and a draw command. The triangle can generate fragments during rasterization; a fragment shader determines their candidate outputs, and a depth buffer test can reject hidden contributions. The interface specifies the results these operations must produce, while implementations can use different internal hardware and scheduling. A rendering command's submission is also distinct from completion of the corresponding device work.[ref]
The OpenGL Graphics System Version 4.6 Core Profile by Khronos Group. Chapters 14, 15 and 17, rasterization, fragment shading and per-fragment operations; §2.3, command execution
Rasterization 2026-11-05
Rasterization converts geometric primitives into candidate contributions at discrete pixel sample positions. For a projected triangle, an implementation tests which samples lie inside its three oriented edges and interpolates attributes from the vertices. With barycentric coordinates , a screen-space linear attribute is . Attributes defined before perspective projection generally need perspective-correct interpolation:Here are the clip-coordinate denominators. Ordinary interpolation would distort a texture seen at an angle.
A generated fragment is not necessarily a final visible pixel: a fragment shader determines its values, a depth buffer can reject hidden contributions, and blending combines surviving contributions. Multiple samples per pixel improve coverage estimates near boundaries but do not recreate arbitrarily fine detail. OpenGL specifies these stages separately, so geometric coverage and final image storage must not be conflated.[ref]
The OpenGL Graphics System Version 4.6 Core Profile by Khronos Group. Chapter14, rasterization and early tests; Chapter15, fragment shading