Skip to main content

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 GLuint as ImTextureID)
  • ✅ 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

The glsl_version parameter should match your OpenGL context:

Configuration Defines

For OpenGL ES, define in your imconfig.h or build system:
These are auto-detected on iOS, Android, and Emscripten.

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 VkDescriptorSet as ImTextureID)
  • ✅ 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* as ImTextureID)
  • ✅ 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 MTLTexture as ImTextureID)
  • ✅ 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 your imconfig.h:

Renderer Backend Lifecycle

All renderer backends follow this pattern:
1

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
2

Per-Frame Update

Call the renderer’s NewFrame() function:
This prepares the backend for rendering.
3

Rendering

After ImGui::Render(), call the renderer’s RenderDrawData() function:
The backend:
  • Sets up render state
  • Binds textures and buffers
  • Submits draw calls
  • Restores previous state
4

Shutdown

Clean up resources before destroying the graphics device:

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

Next Steps

Platform Backends

Learn about platform backends for windowing

Custom Backend

Create your own renderer backend