Skip to content
プロジェクト

概要

Dear imgui renderer for wgpu-rs.

デザイン・メディア

この数値の測り方

計測したスター増加

24時間
0
7日間
+2
15日間
+2
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

imgui-wgpu

GitHub Workflow Status Documentation Crates.io License

A wgpu render backend for dear imgui (imgui-rs).

screenshot

Getting Started

Add imgui-wgpu to your Cargo.toml:

[dependencies]
imgui-wgpu = "0.28"
imgui = "0.12"
wgpu = "29"

Usage

Create a Renderer during setup, then call render() each frame inside a wgpu render pass:

// Setup
let mut imgui = imgui::Context::create();
let renderer_config = imgui_wgpu::RendererConfig {
    texture_format: surface_format, // must match your surface
    ..imgui_wgpu::RendererConfig::new()
};
let mut renderer = imgui_wgpu::Renderer::new(&mut imgui, &device, &queue, renderer_config);

// Per frame
let draw_data = imgui_context.render();
let mut rpass = encoder.begin_render_pass(/* ... */);
renderer.render(draw_data, &queue, &device, &mut rpass).unwrap();

For more control over GPU buffer lifetime, use prepare() + split_render() instead of render().

Color Space

RendererConfig::new() (the default) outputs linear color for sRGB framebuffers (Bgra8UnormSrgb). Use RendererConfig::new_srgb() if rendering to a linear framebuffer (Bgra8Unorm).

Custom Textures

let texture = imgui_wgpu::Texture::new(&device, &renderer, TextureConfig {
    size: wgpu::Extent3d { width: 64, height: 64, depth_or_array_layers: 1 },
    ..Default::default()
});
texture.write(&queue, &pixel_data, 64, 64);
let tex_id = renderer.textures.insert(texture);
// Use tex_id with imgui::Image

Examples

cargo run --release --example hello-world
cargo run --release --example custom-texture
cargo run --release --example cube
Example Description
hello-world Basic imgui window with winit integration
custom-texture Loading and displaying a custom image
cube 3D rendering with an imgui overlay
empty Minimal test for empty draw lists

Version Compatibility

imgui-wgpu wgpu imgui
master 29 0.12
0.28.0 29 0.12
0.27.0 28 0.12
0.26.0 27 0.12
0.25.0 25 0.12
0.24.0 0.17 0.11
0.23.0 0.16 0.11
0.22.0 0.15 0.10
0.21.0 0.14 0.9
0.20.0 0.13 0.8
0.19.0 0.12 0.8
0.18.0 0.11 0.8
0.17.0 0.10 0.8
0.16.0 0.9 0.7
0.15.0 0.8 0.7
0.14.0 0.7 0.7
0.13.0 0.7 0.6
0.12.0 0.6 0.6
0.11.0 0.6 0.5
0.10.0 0.6 0.5
0.9.0 0.6 0.4
0.8.0 0.5 0.4
0.7.0 0.5 0.4
0.6.0 0.5 0.3
0.5.0 0.4 0.3
0.4.0 0.4 0.2
0.1.0 0.3 0.2

Minimum Supported Rust Version (MSRV)

The MSRV of this crate is 1.87. MSRV bumps are considered breaking changes.

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.

関連プロジェクトを探す

読み込み中…