dear-imgui-rs
dear-imgui-rs is a Rust bindings ecosystem for Dear ImGui, featuring docking support, WGPU/GL backends, and popular extensions (ImGuizmo, ImNodes, ImPlot).
What’s in this repo
- Core
dear-imgui-sys— low‑level FFI via cimgui (docking branch), bindgen against Dear ImGui v1.92.5dear-imgui-rs— safe, idiomatic Rust API (RAII + builder style similar to imgui-rs)- Backends:
dear-imgui-wgpu,dear-imgui-glow,dear-imgui-winit,dear-imgui-sdl3 dear-app— convenient Winit + WGPU application runner (docking, themes, add-ons)
- Extensions
dear-imguizmo— 3D gizmo (cimguizmo C API) + a pure‑Rust GraphEditordear-imnodes— node editor (cimnodes C API)dear-implot— plotting (cimplot C API)dear-implot3d— 3D plotting (cimplot3d C API)dear-imguizmo-quat— quaternion + 3D gizmo (cimguizmo_quat C API)dear-file-browser— native dialogs (rfd) + pure ImGui in-UI file browser
All crates are maintained together in this workspace.
Hello, ImGui (Hello World)
use *;
let mut ctx = create;
let ui = ctx.frame;
ui.window
.size
.build;
// Rendering is done by a backend (e.g. dear-imgui-wgpu or dear-imgui-glow)
// Tip: For fallible creation, use `Context::try_create()`
Examples
# Clone with submodules
# Core & docking examples
# dear-app examples (application runner with docking support)
# Extension examples (using wgpu + winit directly)
# implot3d example (uses dear-app)
# SDL3 backends (native)
# SDL3 + OpenGL3 with official C++ backends (multi-viewport via imgui_impl_sdl3/imgui_impl_opengl3)
# SDL3 + Glow (experimental multi-viewport using Rust Glow renderer)
# SDL3 + WGPU (single-window; multi-viewport is intentionally disabled for WebGPU)
Tip: The ImNodes example includes multiple tabs (Hello, Multi-Editor, Style, Advanced Style, Save/Load, Color Editor, Shader Graph, MiniMap Callback).
See examples/README.md for a curated index and the planned from‑easy‑to‑advanced layout.
File Browser
# OS-native dialogs (rfd)
# Pure ImGui in-UI file browser
Installation
Core + Backends
[]
= "0.6"
# Choose a backend + platform integration
= "0.6" # or dear-imgui-glow
0.6.x= "0.6"
Application Runner (Recommended for Quick Start)
[]
= "0.5" # Includes dear-imgui-rs, wgpu backend, and docking support
Extensions
[]
# Plotting
= "0.5" # 2D plotting
0.6.x= "0.5" # 3D plotting
# 3D Gizmos
0.6.x= "0.5" # Standard 3D gizmo + GraphEditor
0.6.x= "0.5" # Quaternion-based gizmo
# Node Editor
= "0.5"
# File Browser
0.6.x= "0.5" # Native dialogs + ImGui file browser
Build Strategy
- Default: build from source on all platforms. Prebuilt binaries are optional and off by default.
- Windows: we publish prebuilt packages (MD/MT, with/without
freetype). Linux/macOS may have CI artifacts but are not used automatically. - Opt-in prebuilt download from Release: enable either the crate feature
prebuiltor set<CRATE>_SYS_USE_PREBUILT=1. Otherwise builds only use prebuilt when you explicitly point to them (e.g.,<CRATE>_SYS_LIB_DIRor<CRATE>_SYS_PREBUILT_URL).
Env vars per -sys crate:
<CRATE>_SYS_LIB_DIR— link from a dir containing the static lib<CRATE>_SYS_PREBUILT_URL— explicit URL to.a/.libor.tar.gz(always honored)<CRATE>_SYS_USE_PREBUILT=1— allow auto download from GitHub Releases<CRATE>_SYS_PACKAGE_DIR— local dir with.tar.gzpackages<CRATE>_SYS_CACHE_DIR— cache root for downloads/extraction<CRATE>_SYS_SKIP_CC— skip C/C++ compilation<CRATE>_SYS_FORCE_BUILD— force source buildIMGUI_SYS_USE_CMAKE/IMPLOT_SYS_USE_CMAKE— prefer CMake when available; otherwise ccCARGO_NET_OFFLINE=true— forbid network; use only local packages or repo prebuilt
Freetype: enable once anywhere. Turning on freetype in any extension (imnodes/imguizmo/implot) propagates to dear-imgui-sys. When using a prebuilt dear-imgui-sys with freetype, ensure the package manifest includes features=freetype (our packager writes this).
Quick examples (enable auto prebuilt download):
- Feature:
cargo build -p dear-imgui-sys --features prebuilt - Env (Unix):
IMGUI_SYS_USE_PREBUILT=1 cargo build -p dear-imgui-sys - Env (Windows PowerShell):
$env:IMGUI_SYS_USE_PREBUILT='1'; cargo build -p dear-imgui-sys
Compatibility (Latest)
The workspace follows a release-train model. The table below lists the latest, recommended combinations. See docs/COMPATIBILITY.md for full history and upgrade notes.
Core
| Crate | Version | Notes |
|---|---|---|
| dear-imgui-rs | 0.6.x | dear-imgui-rs |
| dear-imgui-sys | 0.6.x | Binds Dear ImGui v1.92.5 |
Backends
| Crate | Version | External deps | Notes |
|---|---|---|---|
| dear-imgui-wgpu | 0.6.x | dear-imgui-rs | 0.6.x |
| dear-imgui-glow | 0.6.x | dear-imgui-rs | 0.6.x |
| dear-imgui-winit | 0.6.x | dear-imgui-rs | 0.6.x |
Application Runner
| Crate | Version | Requires dear-imgui-rs | Notes |
|---|---|---|---|
| dear-app | 0.6.x | dear-imgui-rs | 0.6.x |
Extensions
| Crate | Version | Requires dear-imgui-rs | Sys crate | Notes |
|---|---|---|---|---|
| dear-implot | 0.6.x | dear-imgui-rs | 0.6.x | dear-imgui-rs |
| dear-imnodes | 0.6.x | dear-imgui-rs | 0.6.x | dear-imgui-rs |
| dear-imguizmo | 0.6.x | dear-imgui-rs | 0.6.x | dear-imgui-rs |
| dear-implot3d | 0.6.x | dear-imgui-rs | 0.6.x | dear-imgui-rs |
| dear-imguizmo-quat | 0.6.x | dear-imgui-rs | 0.6.x | dear-imgui-rs |
| dear-file-browser | 0.6.x | dear-imgui-rs | 0.6.x | dear-imgui-rs |
Maintenance rules
- Upgrade dear-imgui-sys together with all -sys extensions to avoid C ABI/API drift.
- dear-imgui-rs upgrades may require minor changes in backends/extensions if public APIs changed.
- Backend external deps (wgpu/winit/glow) have their own breaking cycles and may drive backend bumps independently.
CI (Prebuilt Binaries)
- Workflow:
.github/workflows/prebuilt-binaries.yml- Inputs:
tag(release) orbranch(manual; defaultmain)crates: comma-separated list (all,dear-imgui-sys,dear-implot-sys,dear-imnodes-sys,dear-imguizmo-sys)
- Artifacts (branch builds) or Release assets (tag builds) include
.tar.gzpackages named:dear-<name>-prebuilt-<version>-<target>-static[-mt|-md].tar.gz - Release download URLs default to owner/repo configured in
tools/build-support/src/lib.rs. Override via env:BUILD_SUPPORT_GH_OWNER,BUILD_SUPPORT_GH_REPO.
- Inputs:
Version & FFI
- FFI layer is generated from the cimgui “docking” branch matching Dear ImGui v1.92.4.
- We avoid the C++ ABI by using the C API + bindgen. The safe layer mirrors imgui-rs style (RAII + builder).
Crates (workspace)
dear-imgui-rs/ # Safe Rust bindings (renamed from dear-imgui)
dear-imgui-sys/ # cimgui FFI (docking; ImGui v1.92.4)
backends/
dear-imgui-wgpu/ # WGPU renderer
dear-imgui-glow/ # OpenGL renderer
dear-imgui-winit/ # Winit platform
dear-app/ # Application runner (Winit + WGPU + docking + themes)
extensions/
dear-imguizmo/ # ImGuizmo + pure‑Rust GraphEditor
dear-imnodes/ # ImNodes (node editor)
dear-implot/ # ImPlot (2D plotting)
dear-implot3d/ # ImPlot3D (3D plotting)
dear-imguizmo-quat/ # ImGuIZMO.quat (quaternion gizmo)
dear-file-browser/ # File dialogs (rfd) + pure ImGui browser
WebAssembly (WASM) support
This workspace includes an import-style WASM build that reuses a separate cimgui
provider module (imgui-sys-v0) and shares a single WebAssembly.Memory between
the Rust app (wasm-bindgen) and the provider.
Status:
- The web demo (
dear-imgui-web-demo) is wired up and runs onwasm32-unknown-unknown. - The core UI + WGPU backend are supported; clipboard, raw draw callbacks and multi-viewport remain disabled on wasm for safety.
- Font atlas access on wasm is available behind an experimental feature flag.
Prerequisites:
- Rust target:
rustup target add wasm32-unknown-unknown
- wasm-bindgen CLI (version must match the crate’s dependency):
cargo install -f wasm-bindgen-cli --version 0.2.105
- wasm-tools (used by
xtask web-demoto patch memory imports/exports):cargo install -f wasm-tools
- Emscripten SDK (
emsdk) for building the cimgui provider:- Install emsdk and run its env script (
emsdk_env.*) or setEMSDKso thatemcc/em++are onPATH.
- Install emsdk and run its env script (
Quick start (web demo):
# 1) Generate wasm bindings for dear-imgui-sys (optional; xtask will also
# generate them on-demand if missing, using import module name imgui-sys-v0)
# 2) Build the main wasm module + JS glue (optionally enable experimental fonts)
# 3) Build the cimgui provider (emscripten) and import map
# 4) Serve and open in the browser
# Then open http://127.0.0.1:8080
Notes:
- The provider build emits:
target/web-demo/imgui-sys-v0.wasmandimgui-sys-v0.jsimgui-sys-v0-wrapper.js(ESM wrapper) and an import map entry mapping"imgui-sys-v0"to"./imgui-sys-v0-wrapper.js".
xtask web-demo:- Patches the wasm-bindgen output to import memory from
env.memoryand export it. - Patches the JS glue to pass
globalThis.__imgui_shared_memorytoenv.memory.
- Patches the wasm-bindgen output to import memory from
- Font atlas mutation on wasm is guarded by the feature:
dear-imgui-rs/wasm-font-atlas-experimentalexamples-wasm/experimental-fontsturns this on for the web demo only.
For more details and troubleshooting, see docs/WASM.md.
Limitations
- Multi-viewport support
- SDL3 + OpenGL3: supported via upstream C++ backends (
imgui_impl_sdl3+imgui_impl_opengl3).- Example:
cargo run -p dear-imgui-examples --bin sdl3_opengl_multi_viewport --features multi-viewport
- Example:
- winit + WGPU: experimental only; not supported for production use.
- Test example:
cargo run -p dear-imgui-examples --bin multi_viewport_wgpu --features multi-viewport
- Test example:
- SDL3 + WGPU: single-window only; multi-viewport intentionally disabled to match upstream
imgui_impl_wgpu.
- SDL3 + OpenGL3: supported via upstream C++ backends (
- WebAssembly (WASM): Supported via the import-style build described above; some features (clipboard, raw draw callbacks, multi-viewport) remain disabled on wasm.
Related Projects
If you're working with graphics applications in Rust, you might also be interested in:
- asset-importer - A comprehensive Rust binding for the latest Assimp 3D asset import library, providing robust 3D model loading capabilities for graphics applications
- boxdd - Safe, ergonomic Rust bindings for Box2D v3.
Acknowledgments
This project builds upon the excellent work of several other projects:
- Dear ImGui by Omar Cornut - The original C++ immediate mode GUI library
- imgui-rs - Provided the API design patterns and inspiration for the Rust binding approach
- easy-imgui-rs by rodrigorc
- imgui-wgpu-rs - Provided reference implementation for WGPU backend integration
License
Dual-licensed under either of:
- Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (http://opensource.org/licenses/MIT)