Retained mode in computer graphics is a major pattern of
API design in graphics libraries, in which
* the
graphics library, instead of the
client, retains the scene (complete
object model
In computing, object model has two related but distinct meanings:
# The properties of objects in general in a specific computer programming language, technology, notation or methodology that uses them. Examples are the object models of ''Java'', ...
of the
rendering primitives) to be
rendered and
* the
client calls into the
graphics library do not directly cause actual rendering, but make use of extensive indirection to resources, managed thus ''retained'' by the
graphics library.
It does not preclude the use of
double-buffering.
Immediate mode is an alternative approach. Historically, retained mode has been the dominant style in
GUI libraries;
however, both can coexist in the same library and are not necessarily exclusionary in practice.
Overview

In retained mode the
client calls do not directly cause actual rendering, but instead update an
abstract internal model (typically a list of objects) which is maintained within the library's data space. This allows the library to optimize when actual rendering takes place along with the processing of related objects.
Some techniques to optimize rendering include:
* managing
double buffering
* treatment of
hidden surfaces by
backface culling/
occlusion culling (
Z-buffering
A z-buffer, also known as a depth buffer, is a type of data buffer used in computer graphics to store the depth information of fragments. The values stored represent the distance to the camera, with 0 being the closest. The encoding scheme may ...
)
* only transferring data that has changed from one frame to the next from the application to the library
Example of coexistence with immediate mode in the same library is
OpenGL
OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
. OpenGL has immediate mode functions that can use previously defined server side objects (
textures,
vertex buffers and
index buffers,
shader
In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D sceneāa process known as '' shading''. Shaders have evolved to perform a variety of s ...
s, etc.) without resending unchanged data.
Examples of retained mode rendering systems include
Windows Presentation Foundation
Windows Presentation Foundation (WPF) is a free and open-source user interface framework for Windows-based desktop applications. WPF applications are based in .NET, and are primarily developed using C# and XAML.
Originally developed by Microso ...
,
SceneKit on macOS,
and
PHIGS.
See also
*
Compositing window manager
A compositing manager, or compositor, is software that provides applications with an off-screen data buffer, buffer for each window, then Compositing, composites these window buffers into an image representing the screen and writes the result into ...
*
Scene graph
References
{{DEFAULTSORT:Retained Mode
Computer graphics
3D computer graphics