Dear ImGui Rust Bindings
Modern Rust bindings for Dear ImGui with full Dear ImGui v1.92+ support, including dynamic font system, advanced docking, and modern texture management.

Overview
This project provides comprehensive Rust bindings for Dear ImGui v1.92+, featuring:
- Dear ImGui v1.92+ Support: Full support for the latest Dear ImGui features including dynamic font loading,
ImGuiBackendFlags_RendererHasTextures, and modern texture management - Dynamic Font System: On-demand glyph loading, runtime font size adjustment, and custom font loaders (FreeType support)
- Advanced Docking: Complete window docking and layout management with DockSpace API
- Modern Backends: WGPU v26, OpenGL via glow, with automatic texture lifecycle management
- Type Safety: Memory-safe Rust wrappers with zero-cost abstractions
- Cross-Platform: Windows, Linux, macOS support
Note: Multi-viewport support is not currently implemented but may be added in future releases.
Key Features
- Complete Widget Set: All Dear ImGui widgets with type-safe Rust APIs
- Advanced Tables: Sorting, filtering, resizing, and custom rendering
- Custom Drawing: Full DrawList API for custom graphics
- Comprehensive Styling: Theme system with runtime style modifications
- Input Handling: Keyboard, mouse, gamepad with callback support
Crates
dear-imgui/
├── dear-imgui/ # High-level safe Rust bindings
├── dear-imgui-sys/ # Low-level FFI bindings to Dear ImGui C++
├── backends/
│ ├── dear-imgui-wgpu/ # WGPU renderer backend
│ ├── dear-imgui-glow/ # OpenGL renderer backend
│ └── dear-imgui-winit/ # Winit platform integration
└── extensions/
├── dear-imguizmo/ # 3D gizmo manipulation (Work in progress)
└── dear-implot/ # Advanced plotting library
Quick Start
Add to your Cargo.toml:
[]
= "0.1"
= "0.1"
= "0.1"
Basic WGPU example:
use *;
use ;
let mut imgui = create?;
let mut renderer = new?;
// Main loop
let ui = imgui.frame;
ui.window
.size
.build;
let draw_data = imgui.render;
renderer.render;
Examples
Run the included examples to see features in action:
Installation
Add this to your Cargo.toml:
[]
= "0.1"
= "0.1" # For WGPU backend
= "0.1" # For Winit integration
Or for OpenGL support:
[]
= "0.1"
= "0.1" # For OpenGL backend
= "0.1" # For Winit integration
Architecture
Modern Texture Management
This library implements Dear ImGui v1.92+'s ImGuiBackendFlags_RendererHasTextures system, enabling:
- Automatic texture lifecycle management
- Dynamic font atlas resizing
- Backend-agnostic texture operations
- Memory-efficient texture streaming
FFI Layer (dear-imgui-sys)
Direct C++ FFI bindings with MSVC ABI compatibility fixes, handling complex return types and ensuring cross-platform stability.
Safe Layer (dear-imgui)
Type-safe Rust API featuring:
- Builder patterns for complex widgets
- RAII resource management
- Zero-cost abstractions over C++ types
- Comprehensive error handling
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 - Demonstrated solutions for C++ ABI compatibility issues and MSVC fixes that we adapted for our FFI layer
- imgui-wgpu-rs - Provided reference implementation for WGPU backend integration
License
This project is licensed under MIT OR Apache-2.0.
- Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (http://opensource.org/licenses/MIT)
Development Setup
Comparison with imgui-rs
Advantages:
- Dear ImGui v1.92+ support with dynamic fonts and modern texture management
- Built-in docking support
- Modern Rust ecosystem integration (wgpu v26, winit v0.30+)
- Direct C++ FFI without cimgui dependency
- Comprehensive MSVC ABI compatibility
Current Status:
- Production-ready for most use cases
- Active development with regular updates
- Growing ecosystem of extensions
Choose this library if you need the latest Dear ImGui features, docking support, or want to work with modern Rust graphics libraries.
Technical Details
MSVC ABI Compatibility
One of the key technical challenges in creating Rust bindings for C++ libraries is handling ABI (Application Binary Interface) compatibility issues. This is particularly problematic on MSVC where small C++ class return types can cause crashes.
Our solution, inspired by easy-imgui-rs, includes:
- FFI-Safe Wrapper Types: Convert C++ types like
ImVec2to POD equivalents - C Wrapper Functions: Provide C-compatible interfaces for problematic functions
- Conditional Compilation: Apply fixes only where needed (MSVC targets)
- Selective Function Blocking: Block problematic functions during bindgen and provide manual implementations
See dear-imgui-sys/README.md for detailed technical information.