Immediate mode GUI
Immediate mode GUI, also known as IMGUI, is a code-driven GUI (Graphical User Interface) framework. It is an apparatus for software engineers and is driven by calls to the OnGUI work on any content which actualizes it.

Meaning
"GUI" represents Graphical User Interface. It alludes to an interface to electronic gadgets like PCs and tablets that uses realistic components. The realistic components empower clients to provide commands to the PC and select functions by utilizing a mouse or other gadgets.[1]
"Immediate Mode" means the manner in which the IMGUI is made and drawn. To make IMGUI components, you should compose code that proceeds into a special function named OnGUI. The code to show the interface is executed each frame and drawn to the screen. There are no persevering game objects other than the item to which your OnGUI code is joined.
In technical terms it means the client directly holds all widgets and composes the graphics objects to render the widgets of the complete GUI, or the client directly inserts the rendering primitives into a command list to render frame-by-frame.
Without the use of extensive indirection to retained resources and where:
- The event processing is directly controlled and completely implemented by the client (in contrast to a ready to use basic event processing by a GUI system/library utilizing predefined events/callbacks or signals/slots), and
- The lists of graphical objects to be rendered are kept by the client and all drawing commands required to describe the entire GUI must be re-issued to the graphics pipeline each time a new frame is required.

The other major pattern of API design in graphics libraries is the retained mode.[2] In the retained mode, the rendering primitives are managed by the GUI system/library, often hidden from the client code.
Implementations
Most of the immediate mode GUI widget toolkit are implemented in default system controls and custom rendering for: game development, graphic apps, Library: Scaleform, Dear ImGui
For game implementation;
- a GUI needs to be updated in sync with the game scene or complex graphic
- a GUI needs to 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)
- or a GUI should 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 primitives and API design which affect the graphics pipeline implementation.
Immediate mode GUI widget toolkit 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
- less complex and easier to understand (in terms of fewer implicit assumptions per tool set API call) - this usually also results in less functionality
- more elaborate (typically needs more tool set API calls) to create and manage 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 logical tree/visual tree itself
- has to rebuild the vertex buffers completely from scratch for each new frame, and thus
- can put a constant work load on the CPU if not utilizing shaders loaded on the GPU
Therefore immediate mode GUI widget toolkits are a good choice for all those who want a simple but 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 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
The original Immediate Mode GUI toolkit was imgui by Adrien Herubel[3] which is based on OpenGL. The idea was popularized by Casey Muratori.
In 1979, the Xerox Palo Alto Research Center developed the first prototype for a GUI. A young man named Steve Jobs, looking for new ideas to work into future iterations of the Apple computer, traded US$1 million in stock options to Xerox for a detailed tour of their facilities and current projects.One of the things Xerox showed Jobs was the Alto, which sported a GUI and a three-button mouse.When Jobs saw this prototype, he had an epiphany and set out to bring the GUI to the public.
Other types of Immediate Mode GUI
- nuklear[4] with backends for several graphics libraries (Direct3D, GLFW, OpenGL, SDL, SFML, Wayland, Windows DGI, Window GDI+ and X11),
- kiss_sdl[5] for SDL (Simple DirectMedia Layer),
- Gio[6] for Go, or
- Dear ImGui[7] written in C++ with back-ends for several graphics APIs (Allegro 5 , DirectX, GLFW, iOS, Marmalade, Metal, OpenGL, SDL 2 and Vulkan), that also has
References
- "Immediate Mode GUI Programming". eliasnaur.com. Retrieved 2020-08-06.
- Radich, Quinn (May 30, 2018). "Retained Mode Versus Immediate Mode". Win32 apps. Microsoft. Retrieved 21 December 2019.
- Herubel, Adrien (2019-12-18). "AdrienHerubel/imgui: A small multiplatform immediate mode graphical user interface with OpenGL3.2 backend".
- Mettke, Micha (2019-12-22). "vurtun/nuklear: A single-header ANSI C gui library".
- Korrovits, Tarvo (2019-12-19). "actsl/kiss_sdl: Simple generic GUI widget toolkit for SDL2".
- "Gio - immediate mode GUI in Go". gioui.org. Retrieved 2019-11-14.
- Cornut, Omar (2019-12-22). "ocornut/imgui: Dear ImGui: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies".
- kotlin-graphics (2019-12-19). "kotlin-graphics/imgui: Bloat-free Immediate Mode Graphical User interface for JVM with minimal dependencies (rewrite of dear imgui)".