Skip to main content

What are Backends?

Dear ImGui is highly portable and only requires a few things to run and render. The backend system separates platform-specific code from the core library, making it easy to integrate Dear ImGui into any application.

Core Requirements

Dear ImGui backends handle these essential tasks:
  • Input handling: Mouse, keyboard, gamepad, and touch events
  • Texture management: Creating, updating, and destroying textures
  • Rendering: Drawing indexed textured triangles with clipping rectangles

Optional Features

Backends can also support advanced features:
  • Custom texture binding
  • Clipboard support
  • Gamepad support
  • Mouse cursor shapes
  • IME (Input Method Editor) support
  • Multi-viewport support

Backend Architecture

Dear ImGui uses a two-backend system that separates concerns:

Platform Backend

Handles windowing, input events, timing, and OS integration

Renderer Backend

Handles graphics API calls, texture management, and drawing

Why Two Backends?

This separation provides flexibility:
  • Mix and match platforms with renderers (e.g., GLFW + OpenGL, SDL2 + Vulkan, Win32 + DirectX11)
  • Reuse platform code across different graphics APIs
  • Easier to maintain and debug
  • Better portability across systems
An application typically combines one Platform backend + one Renderer backend + the main Dear ImGui library.

Available Backends

Platform Backends

These handle windowing and input:

Renderer Backends

These handle graphics API calls:

High-Level Framework Backends

Some backends combine platform and renderer:
  • imgui_impl_allegro5.cpp - Allegro 5 game library
  • imgui_impl_null.cpp - Null backend for testing
For new cross-platform projects:

SDL3 + OpenGL3

Best for most projectsModern, stable, cross-platform

GLFW + Vulkan

Best for high-performance appsModern, explicit control
For Windows-only applications:

Win32 + DirectX11

The Win32 backend handles Windows-specific features better than cross-platform alternatives, including multi-viewport support.

Basic Integration Pattern

Here’s the typical flow for integrating Dear ImGui:
1

Initialize Platform Backend

Create your window and initialize the platform backend:
2

Initialize Renderer Backend

Initialize the renderer backend with graphics API context:
3

Main Loop

In your render loop, call NewFrame for both backends:
4

Cleanup

Shutdown backends in reverse order:

Backend Flags

Backends advertise their capabilities through ImGuiBackendFlags:

Platform Backend Flags

Renderer Backend Flags

Starting with Dear ImGui 1.92.0 (June 2025), support for ImGuiBackendFlags_RendererHasTextures is required for all backends to enable dynamic font scaling and other new features.

Emscripten / WebAssembly Support

Several backends support compiling to WebAssembly:
  • SDL2/SDL3 + OpenGL3
  • GLFW + OpenGL3
  • GLFW + WebGPU
These examples are ready to build and run with Emscripten.

Next Steps

Platform Backends

Learn about platform backends for windowing and input

Renderer Backends

Learn about renderer backends for graphics APIs

Custom Backend

Create your own custom backend

Examples

See complete integration examples