Dear ImGui Backends: Every Official Platform and Renderer Option Explained
Dear ImGui ships with 20 official backends inside the backends/ folder—11 platform backends for windowing and input, and 9 renderer backends for GPU draw-list execution—that you pair together to integrate the library into any application.
Dear ImGui (ocornut/imgui) is designed as a self-contained UI library that relies on external backends to connect to the operating system and graphics hardware. The repository's backends/ directory contains the complete set of officially maintained reference implementations, each following the imgui_impl_*.cpp/.h naming convention. Understanding which ImGui backends exist and how they interact is essential for choosing the right integration strategy for your project.
Architecture of Dear ImGui Backends
Each backend bridges a specific gap between the core Dear ImGui library and the host application. Platform backends handle windowing, input devices, clipboard access, and IME composition by populating fields in ImGuiIO. Renderer backends consume ImGui's draw-list data and transform it into GPU commands, managing vertex buffers, textures, and render state. A typical integration uses exactly one platform backend and one renderer backend simultaneously, although the Null platform backend can be paired with any renderer for headless testing.
Official Platform Backends
The platform backends reside in backends/imgui_impl_*.cpp/.h files and wrap the native windowing and event loop of the target OS or library.
- Win32 —
backends/imgui_impl_win32.cpp/hhandles the Windows window procedure, mouse and keyboard input, clipboard, and IME. - GLFW —
backends/imgui_impl_glfw.cpp/hprovides cross-platform windowing and input for GLFW 2 and GLFW 3. - SDL2 —
backends/imgui_impl_sdl2.cpp/hintegrates SDL 2 windows, events, clipboard, and game-controller input. - SDL3 —
backends/imgui_impl_sdl3.cpp/his the updated platform layer for SDL 3. - SDL_Renderer 2 —
backends/imgui_impl_sdlrenderer2.cpp/htargets SDL 2's built-in 2D renderer API. - SDL_Renderer 3 —
backends/imgui_impl_sdlrenderer3.cpp/htargets SDL 3's built-in 2D renderer API. - SDL_GPU 3 —
backends/imgui_impl_sdlgpu3.cpp/hconnects directly to SDL 3's low-level GPU API. - GLUT / FreeGLUT —
backends/imgui_impl_glut.cpp/hoffers legacy GLUT windowing, primarily for quick demos. - Allegro 5 —
backends/imgui_impl_allegro5.cpp/hwraps Allegro 5 window and input facilities. - Android —
backends/imgui_impl_android.cpp/hmanages native Android windows and touch input. - Null —
backends/imgui_impl_null.cpp/his a no-op platform backend useful for automated unit tests.
Official Renderer Backends
Renderer backends implement the RenderDrawData phase and are responsible for turning ImGui's geometry into visible pixels.
- OpenGL 2 —
backends/imgui_impl_opengl2.cpp/huses the legacy OpenGL 2.x fixed-function pipeline. - OpenGL 3 —
backends/imgui_impl_opengl3.cpp/huses a modern OpenGL 3+ core-profile shader pipeline. - Vulkan —
backends/imgui_impl_vulkan.cpp/himplements a full Vulkan rendering path. - DirectX 9 —
backends/imgui_impl_dx9.cpp/htargets DirectX 9. - DirectX 10 —
backends/imgui_impl_dx10.cpp/htargets DirectX 10. - DirectX 11 —
backends/imgui_impl_dx11.cpp/htargets DirectX 11. - DirectX 12 —
backends/imgui_impl_dx12.cpp/htargets DirectX 12. - WebGPU —
backends/imgui_impl_wgpu.cpp/hprovides an experimental renderer via the wgpu implementation of WebGPU.
Common Backend Pairings and Code Examples
The following snippets demonstrate how to initialize typical platform-plus-renderer combinations. All examples assume the corresponding imgui_impl_*.cpp sources are compiled into the project.
GLFW and OpenGL 3
A widely used cross-desktop pairing. The GLFW backend creates the window surface and captures input, while the OpenGL 3 backend compiles shaders and draws geometry.
// Main.cpp (excerpt)
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // optional
// Initialise platform back-end
ImGui_ImplGlfw_InitForOpenGL(window, true);
// Initialise renderer back-end
ImGui_ImplOpenGL3_Init("#version 130");
// Main loop
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// …your UI code…
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
glfwSwapBuffers(window);
}
Win32 and DirectX 11
For native Windows applications, the Win32 platform backend manages the HWND message loop and raw input events. The DirectX 11 renderer backend accepts the ID3D11Device context and submits indexed draw calls for ImGui's vertex buffers.
// Win32 DirectX11 initialisation (excerpt)
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
ImGui_ImplWin32_Init(hwnd); // Platform
ImGui_ImplDX11_Init(device, device_context); // Renderer
// In the render loop
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
/* UI code */
ImGui::Render();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
SDL2 and Vulkan
This pairing uses SDL2 for portable window and event management and Vulkan for explicit, low-level GPU control. The platform setup uses ImGui_ImplSDL2_InitForVulkan, while the renderer requires an ImGui_ImplVulkan_InitInfo structure and a valid Vulkan render pass.
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
ImGui_ImplSDL2_InitForVulkan(window); // Platform
ImGui_ImplVulkan_Init(&init_info, render_pass); // Renderer
// Each frame
ImGui_ImplVulkan_NewFrame();
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();
/* UI code */
ImGui::Render();
ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), command_buffer);
Null and OpenGL 2 for Headless Testing
When running automated tests or logic-only validation, the Null platform backend satisfies ImGui's input requirements without creating a real window. The OpenGL 2 renderer still processes draw data, allowing ImGui::Render() to execute in headless environments.
ImGui::CreateContext();
ImGui_ImplNull_Init(); // No platform input
ImGui_ImplOpenGL2_Init(); // Renderer (still required for drawing)
// Render loop omitted – useful for unit-test scenarios where you only call ImGui::Render()
Summary
- Dear ImGui's official ImGui backends live in the
backends/folder and follow theimgui_impl_*.cpp/.hnaming convention. - Platform backends feed OS events, mouse state, keyboard input, clipboard, and IME data into
ImGuiIO. - Renderer backends consume ImGui draw lists and emit GPU commands through vertex buffers and texture bindings.
- A standard application combines one platform backend with one renderer backend, such as
GLFW + OpenGL3orWin32 + DirectX11. - The Null platform backend enables headless, UI-only testing when paired with any renderer backend.
- Every backend exposes the same lifecycle hooks—
Init,NewFrame,RenderDrawData, andShutdown—making custom implementations straightforward.
Frequently Asked Questions
What is the difference between a platform backend and a renderer backend?
Platform backends, such as imgui_impl_glfw.cpp or imgui_impl_win32.cpp, connect the host windowing system to Dear ImGui by filling ImGuiIO fields with mouse, keyboard, and clipboard state. Renderer backends, such as imgui_impl_opengl3.cpp or imgui_impl_vulkan.cpp, interpret ImGui's output draw lists and translate them into the shading, buffer, and draw commands required by the target graphics API.
Can I mix any platform backend with any renderer backend?
Yes. Dear ImGui's architecture deliberately separates windowing from rendering, so you can combine almost any platform backend with any renderer backend. Popular combinations include GLFW + OpenGL3 for cross-platform desktops, SDL2 + Vulkan for explicit GPU control, and Win32 + DirectX12 for native Windows performance.
Which ImGui backend should I choose for a new cross-platform project?
For new desktop projects, the GLFW platform backend paired with the OpenGL 3 renderer is the most common and well-documented starting point. GLFW abstracts Windows, macOS, and Linux windowing, while the OpenGL 3 backend provides a modern, shader-based pipeline that is easy to integrate with existing OpenGL code.
How do I implement a custom backend for an unsupported platform?
Study backends/imgui_impl_null.cpp for the minimal required surface area, then implement the four core functions—ImGui_ImplXXXX_Init, ImGui_ImplXXXX_NewFrame, ImGui_ImplXXXX_RenderDrawData, and ImGui_ImplXXXX_Shutdown—and set the relevant flags in ImGuiIO::BackendFlags. Reference backends/imgui_impl_win32.cpp and backends/imgui_impl_opengl3.cpp for complete platform and renderer implementations.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →