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:| Backend | Platform | Features |
|---|---|---|
imgui_impl_glfw.cpp | Windows, macOS, Linux | Cross-platform, modern, recommended |
imgui_impl_sdl2.cpp | Windows, macOS, Linux, iOS, Android | Cross-platform, stable |
imgui_impl_sdl3.cpp | Windows, macOS, Linux, iOS, Android | Latest SDL, recommended for new projects |
imgui_impl_win32.cpp | Windows | Native Windows API, best for Windows-only apps |
imgui_impl_osx.mm | macOS | Native macOS API |
imgui_impl_android.cpp | Android | Android native app API |
imgui_impl_glut.cpp | Cross-platform | Legacy, not recommended |
Renderer Backends
These handle graphics API calls:| Backend | Graphics API | Features |
|---|---|---|
imgui_impl_opengl3.cpp | OpenGL 3/4, OpenGL ES 2/3, WebGL | Modern OpenGL with shaders |
imgui_impl_opengl2.cpp | OpenGL 2 | Legacy fixed pipeline, not recommended |
imgui_impl_vulkan.cpp | Vulkan | Modern, explicit graphics API |
imgui_impl_dx9.cpp | DirectX 9 | Legacy DirectX |
imgui_impl_dx10.cpp | DirectX 10 | DirectX 10 |
imgui_impl_dx11.cpp | DirectX 11 | Modern DirectX, widely used |
imgui_impl_dx12.cpp | DirectX 12 | Modern, explicit DirectX API |
imgui_impl_metal.mm | Metal | Apple’s modern graphics API |
imgui_impl_wgpu.cpp | WebGPU | Web + desktop, next-gen graphics API |
imgui_impl_sdlgpu3.cpp | SDL_GPU | SDL3’s portable 3D graphics API |
imgui_impl_sdlrenderer2.cpp | SDL_Renderer | SDL2’s 2D renderer |
imgui_impl_sdlrenderer3.cpp | SDL_Renderer | SDL3’s 2D renderer |
High-Level Framework Backends
Some backends combine platform and renderer:imgui_impl_allegro5.cpp- Allegro 5 game libraryimgui_impl_null.cpp- Null backend for testing
Recommended Backends
For new cross-platform projects:SDL3 + OpenGL3
Best for most projectsModern, stable, cross-platform
GLFW + Vulkan
Best for high-performance appsModern, explicit control
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:Backend Flags
Backends advertise their capabilities throughImGuiBackendFlags:
Platform Backend Flags
| Flag | Description |
|---|---|
ImGuiBackendFlags_HasGamepad | Supports gamepad input |
ImGuiBackendFlags_HasMouseCursors | Can change OS cursor shape |
ImGuiBackendFlags_HasSetMousePos | Can reposition OS mouse |
ImGuiBackendFlags_PlatformHasViewports | Supports multi-viewports |
ImGuiBackendFlags_HasMouseHoveredViewport | Can detect viewport under mouse |
Renderer Backend Flags
| Flag | Description |
|---|---|
ImGuiBackendFlags_RendererHasVtxOffset | Supports large meshes (64k+ vertices) |
ImGuiBackendFlags_RendererHasTextures | Supports dynamic texture updates |
Emscripten / WebAssembly Support
Several backends support compiling to WebAssembly:- SDL2/SDL3 + OpenGL3
- GLFW + OpenGL3
- GLFW + WebGPU
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