
An immediate mode graphic user interface (GUI), also known as IMGUI, is a
graphical user interface design pattern
A design pattern is the re-usable form of a solution to a design problem. The idea was introduced by the architect Christopher Alexander and has been adapted for various other disciplines, particularly software engineering. The " Gang of Four" b ...
which uses an
immediate mode graphics
library
A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vi ...
to create the GUI. The other major pattern of
API design in
graphics libraries
A graphics library is a program library designed to aid in rendering computer graphics to a monitor. This typically involves providing optimized versions of functions that handle common rendering tasks. This can be done purely in software and runn ...
is the
retained mode.
Implementations
Most of the
immediate mode GUI
widget toolkit
A widget toolkit, widget library, GUI toolkit, or UX library is a library or a collection of libraries containing a set of graphical control elements (called ''widgets'') used to construct the graphical user interface (GUI) of programs.
Most wid ...
is implemented in default system controls and custom rendering for
game development, graphic apps, Library: Scale form, and Dear ImGui.
For game implementation, a
GUI should
* be updated in sync with the game scene or complex graphic.
* be overlaid on a game scene or complex graphic (which is especially easy in both cases, when both GUI and game scene are controlled by the game loop).
* have an unusual appearance or be pepped with complex graphic. This implies that in an
immediate mode GUI, the
client code is holding its own
rendering primitive
This is a glossary of terms relating to computer graphics.
For more general computer hardware terms, see glossary of computer hardware terms.
0–9
A
B
...
s and API design which affects the
graphics pipeline
In computer graphics, a computer graphics pipeline, rendering pipeline or simply graphics pipeline, is a conceptual model that describes what steps a graphics system needs to perform to render a 3D scene to a 2D screen. Once ...
implementation.
The
immediate mode GUI
widget toolkit
A widget toolkit, widget library, GUI toolkit, or UX library is a library or a collection of libraries containing a set of graphical control elements (called ''widgets'') used to construct the graphical user interface (GUI) of programs.
Most wid ...
* is more direct in the sense that the
widget tree is often a function call tree that is composable and flexible but hard to interact with.
* is less complex and easier to understand (in terms of fewer implicit assumptions per toolset API call). This usually also results in less functionality.
* is more elaborate to create and manage (typically needs more tool set API calls) if more than a simple
widget tree, including layout (absolute and relative positioning referring to parent or siblings).
* has less sophisticated
occlusion culling (
z-buffering),
hit-testing, state change handling,
scrolling, and
focus/hot
control (
widget) animations. This also implies the need to manage the logical tree/visual tree itself.
* has to rebuild the
vertex buffers completely from scratch for each new
frame.
* can put a constant workload on the
CPU
A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, and ...
if not utilizing
shaders loaded on the
GPU.
Immediate mode GUI
widget toolkit
A widget toolkit, widget library, GUI toolkit, or UX library is a library or a collection of libraries containing a set of graphical control elements (called ''widgets'') used to construct the graphical user interface (GUI) of programs.
Most wid ...
s are a good choice for those who prefer a simple, easily changeable, and extendable GUI toolkit. They are usually generic, open-source, and cross-platform. One way to have the flexibility and composability of an
immediate mode GUI without the disadvantages of keeping the
widget tree only in function calls, with the lack of direct control of how the
GUI is drawn in the
rendering engine would be to use a virtual
widget tree, just like
React uses a virtual
DOM.
History
Casey Muratori developed the technique and coined the term "Single-path Immediate Mode Graphical User Interface" to describe it. One of the earliest publicly available implementations was written by Sean Barrett.
Other types of immediate mode GUI
* Dear ImGui written in C++ with back-ends for several graphics APIs (
Allegro 5,
DirectX
Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direc ...
,
GLFW,
iOS,
Marmalade,
Metal
A metal (from Greek μέταλλον ''métallon'', "mine, quarry, metal") is a material that, when freshly prepared, polished, or fractured, shows a lustrous appearance, and conducts electricity and heat relatively well. Metals are typi ...
,
OpenGL
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
,
SDL 2 and
Vulkan), that also has
** projects for additional back-end support (
Android
Android may refer to:
Science and technology
* Android (robot), a humanoid robot or synthetic organism designed to imitate a human
* Android (operating system), Google's mobile operating system
** Bugdroid, a Google mascot sometimes referred to ...
,
Irrlicht Engine,
OGRE
An ogre ( feminine: ogress) is a legendary monster depicted as a large, hideous, man-like being that eats ordinary human beings, especially infants and children. Ogres frequently feature in mythology, folklore, and fiction throughout the wor ...
,
SFML, ...)
** projects for additional language bindings (
C#/.NET,
D,
Go,
Haskell,
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
, ...)
** ports to other languages (such as Java)
* egui for
Rust
* Gio for
Go
* kiss_sdl for
SDL (Simple Direct Media Layer)
* nuklear
with backends for several graphics libraries (
Direct3D,
GLFW,
OpenGL
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
,
SDL,
SFML,
Wayland, Windows
GDI, Window
GDI+ and
X11)
References
{{Reflist
Computer graphics
Graphical user interfaces