Skip to main content

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:

Example Comparison

Dear ImGui (Immediate Mode):
Traditional Toolkit (Retained Mode):

What IMGUI Really Means

Many people misunderstand what “immediate mode” means. It does NOT refer to immediate mode rendering!
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
IMGUI does NOT refer to the implementation. What happens inside the library doesn’t matter. Dear ImGui actually uses retained data structures internally for efficiency - it builds optimized vertex buffers and command lists.
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:
The 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:
You can even create UI for local variables during development:

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
Dear ImGui is NOT designed for end-user application UIs where you need full internationalization, accessibility features, or platform-native look and feel.

The Single Pass Model

Dear ImGui uses a single-pass immediate mode model:
This differs from Unity’s IMGUI which uses multiple passes. There are pros and cons to each approach, but the single-pass model offers:
  • Simpler mental model
  • Better performance
  • More predictable behavior

Best Practices

Keep Application Data Separate

Embrace the Frame-by-Frame Model

Use Early Outs for Performance

Further Reading