Overview
Renderer backends handle the graphics API interface for Dear ImGui. They are responsible for:- Creating and updating textures (font atlas, user textures)
- Compiling and managing shaders
- Setting up render state (blending, scissor testing, etc.)
- Rendering indexed triangle meshes with clipping
- Managing graphics API resources
Renderer backends must be paired with a Platform Backend for windowing and input.
Available Renderer Backends
OpenGL3 Backend
File:imgui_impl_opengl3.cpp / imgui_impl_opengl3.h
Best for cross-platform desktop and web
Supports modern OpenGL (3.x/4.x), OpenGL ES (2.0/3.0), and WebGL. The most portable renderer backend.
Features
- ✅ User texture binding (use
GLuintasImTextureID) - ✅ Large meshes support (64k+ vertices) on desktop OpenGL
- ✅ Dynamic texture updates
- ✅ Supports desktop GL, GLES, and WebGL
Supported APIs
- Desktop OpenGL 2.x, 3.x, 4.x
- OpenGL ES 2.0 (WebGL 1.0)
- OpenGL ES 3.0 (WebGL 2.0)
Basic Usage
GLSL Version Selection
Theglsl_version parameter should match your OpenGL context:
Configuration Defines
For OpenGL ES, define in yourimconfig.h or build system:
API Functions
Vulkan Backend
File:imgui_impl_vulkan.cpp / imgui_impl_vulkan.h
Modern explicit graphics API
Vulkan backend with full control over rendering pipeline. Best for high-performance applications.
Features
- ✅ User texture binding (use
VkDescriptorSetasImTextureID) - ✅ Large meshes support (64k+ vertices)
- ✅ Dynamic texture updates
- ✅ Dynamic rendering support (Vulkan 1.3)
- ✅ Exposes render state for callbacks
Initialization
Vulkan backend requires more setup than other backends:Texture Management
Register custom textures with Vulkan:Dynamic Rendering (Vulkan 1.3+)
DirectX 11 Backend
File:imgui_impl_dx11.cpp / imgui_impl_dx11.h
Recommended for Windows desktop
DirectX 11 is well-supported, stable, and provides excellent performance on Windows.
Features
- ✅ User texture binding (use
ID3D11ShaderResourceView*asImTextureID) - ✅ Large meshes support (64k+ vertices)
- ✅ Dynamic texture updates
- ✅ Exposes render state for callbacks
Basic Usage
API Functions
DirectX 12 Backend
File:imgui_impl_dx12.cpp / imgui_impl_dx12.h
Modern explicit DirectX API, similar complexity to Vulkan. Best for applications that need fine-grained control over GPU resources.
Metal Backend
File:imgui_impl_metal.mm / imgui_impl_metal.h
Apple's modern graphics API
Metal backend for macOS and iOS. Supports both Objective-C and C++ APIs.
Features
- ✅ User texture binding (use
MTLTextureasImTextureID) - ✅ Large meshes support (64k+ vertices)
- ✅ Dynamic texture updates
- ✅ ObjC and C++ API support
Basic Usage (Objective-C)
WebGPU Backend
File:imgui_impl_wgpu.cpp / imgui_impl_wgpu.h
Next-generation web and native graphics
WebGPU is the future of web graphics and also works natively. Supports both desktop and web platforms.
Configuration
Define the WebGPU backend in yourimconfig.h:
Renderer Backend Lifecycle
All renderer backends follow this pattern:Initialization
Initialize the renderer backend after creating the graphics device:The backend sets up:
- Shaders and pipeline state
- Default texture (font atlas)
- Vertex/index buffers
- Backend flags
Rendering
After The backend:
ImGui::Render(), call the renderer’s RenderDrawData() function:- Sets up render state
- Binds textures and buffers
- Submits draw calls
- Restores previous state
Custom Texture Usage
All renderer backends support custom textures:OpenGL3
Vulkan
DirectX 11
Render State Access
Some backends expose render state for custom draw callbacks:Advanced: Manual Texture Updates
For precise control over texture update timing (e.g., for staged rendering):Backend Comparison
| Feature | OpenGL3 | Vulkan | DX11 | DX12 | Metal | WebGPU |
|---|---|---|---|---|---|---|
| Complexity | Low | High | Low | High | Medium | Medium |
| Portability | Excellent | Good | Windows | Windows | Apple | Excellent |
| Performance | Good | Excellent | Good | Excellent | Excellent | Good |
| Setup Code | Minimal | Extensive | Moderate | Extensive | Moderate | Moderate |
| WebAssembly | Yes | No | No | No | No | Yes |
Next Steps
Platform Backends
Learn about platform backends for windowing
Custom Backend
Create your own renderer backend