Immediate Mode vs Retained Mode

» Glossary » Immediate mode VS retained mode

Graphics APIs can be divided into immediate and retained mode depending on how they operate:

 

  • Immediate mode APIs: application state is separated from the graphics library. It’s the application responsibility to issue the drawing commands when necessary (for each frame, when some part of the state changes, etc).

 

Immediate mode API

 

  • Retained mode APIs: the graphics library maintains internal state that caches/duplicates the application state. It’s the graphics library responsibility to draw the UI when that internal state changes. The graphics library often offers some callbacks for the application to update other parts of the state when the UI components state changes.

 

RetainedMode
Retained mode API

 

IMGUI: Immediate Mode Graphical User Interfaces

In 2002, two indie games programmers (Casey Muratori and Johannes Norneby) suggested using the immediate mode style to create User Interfaces.

 

The first 10 minutes of Muratori’s intro video suffice to grasp the differences:

 

 

Immediate mode libraries for the web

 

React is a JavaScript library to build User Interfaces that follow the immediate mode pattern.