Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ocornut/imgui/llms.txt
Use this file to discover all available pages before exploring further.
What is Immediate Mode?
Dear ImGui implements the Immediate Mode GUI (IMGUI) paradigm, which is fundamentally different from traditional retained-mode UI toolkits like Qt, GTK, or WPF.The Core Concept
In immediate mode, your application code creates the entire UI every frame. There’s no persistent UI tree or widget objects that need to be managed. The UI is described procedurally as part of your application loop.If your code doesn’t run, the UI is gone! This is by design and is actually a powerful feature.
Immediate Mode vs Retained Mode
Here’s how Dear ImGui differs from traditional UI toolkits:| Dear ImGui (Immediate Mode) | Qt/GTK/WPF (Retained Mode) |
|---|---|
| UI fully issued on every update | UI issued once, then modified |
| UI layout is fully dynamic | UI layout is mostly static |
| Application submits UI and forgets about it | Application manages widget objects |
| Minimal data storage in UI library | Entire widget tree stored |
| UI code can be added anywhere | UI code in dedicated spots |
| Data is naturally synchronized | Manual synchronization via signals/callbacks |
| Simple, low-level API | Complex, high-level API |
Example Comparison
Dear ImGui (Immediate Mode):What IMGUI Really Means
IMGUI refers to the API - the interface between your application and the UI system:- An IMGUI API favors the application owning its data as the single source of truth
- An IMGUI API minimizes state retention in the UI system
- An IMGUI API minimizes state retention by the application about UI elements
- Synchronization between application data and UI data is natural and automatic
Dear ImGui outputs efficient batched draw calls. It’s not “hammering your GPU” - it creates optimized vertex buffers once per frame.
Key Advantages
1. No State Synchronization
Your application data is the source of truth. There’s no separate “UI state” to keep in sync:player struct is directly edited. No callbacks, no data binding, no synchronization bugs.
2. Dynamic UIs Are Easy
You can create UI based on arbitrary logic:3. UI Code Can Live Anywhere
You can add UI anywhere in your codebase:Common Misconceptions
”Immediate Mode is Slow”
False. People confuse immediate mode GUI with immediate mode rendering. Dear ImGui:- Builds optimized vertex buffers and command lists
- Batches draw calls efficiently
- Minimizes state changes
- Doesn’t touch GPU directly during UI code
- A typical idle frame never calls malloc/free
”You Can’t Do Complex UIs”
False. Dear ImGui is used in professional game engines, debuggers, and tools. See examples:”Data is Recreated Every Frame”
False. Only the UI description is recreated. Your application data lives in your own structures and is only modified when the user interacts with widgets.When to Use Immediate Mode
Immediate mode GUIs excel at:- Developer tools - debuggers, profilers, editors
- Content creation tools - level editors, animation tools
- Debug/visualization overlays - in-game debug menus
- Data-driven UIs - reflecting dynamic or changing data
- Rapid prototyping - quick iteration on UI design
- Game engine integration - tools within a game engine
The Single Pass Model
Dear ImGui uses a single-pass immediate mode model:- Simpler mental model
- Better performance
- More predictable behavior