Added some comments, updated README with progress notes

This commit is contained in:
4bb4 2020-10-30 12:51:57 +01:00
parent 40f0cc8564
commit eab6d9a9d1
3 changed files with 11 additions and 6 deletions

View file

@ -8,8 +8,9 @@ Things are structured as follows:
* [implot-glium-examples](implot-glium-examples/) is an example for using `implot-rs` in
conjunction with a [Glium](https://github.com/glium/glium) backend.
* [implot-wgpu-examples](implot-wgpu-examples/) is an example for using `implot-rs` in
conjunction with a [WebGPU](https://github.com/gfx-rs/wgpu) backend.
conjunction with a [WebGPU](https://github.com/gfx-rs/wgpu) backend (work in progress, this
uses wgpu, but does currently not make use of `examples-shared` yet and has not been refactored
to look the same as the glium example structurally)
If you want to just copy-paste code to start with, copy `examples-shared` along with
your favourite backend example crate.
your favourite backend example crate. The glium backend code is largely taken from imgui-rs.

View file

@ -5,7 +5,7 @@ authors = ["Benedikt Mandelkow <benedikt.mandelkow@rwth-aachen.de>", "imgui-wgpu
edition = "2018"
[dependencies]
implot = { path = "../" }
implot = { path = "../../" }
wgpu = "^0.6.0"
winit = "^0.22.2" # opening windows and handling input
@ -13,3 +13,4 @@ futures = "^0.3.5" # executing async functions using blocking executor
imgui = "^0.5.0"
imgui-winit-support = "^0.5.0" # connection of input (keys) to imgui
imgui-wgpu = "^0.11.0" # imgui backend for drawing using wgpu
examples-shared = { path = "../examples-shared" }

View file

@ -9,10 +9,11 @@ use winit::{
window::Window,
};
// the actual implot samples are in there
// the actual implot samples are in there TODO(4bb4) move to using examples-shared instead
mod ui;
fn main() {
// --- Backend setup ----------------------------------------------------------------
// Set up window and GPU
let event_loop = EventLoop::new();
let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY);
@ -97,7 +98,7 @@ fn main() {
let mut showing_demo = false;
let mut make_fullscreen = false;
// Event loop
// --- Event loop -------------------------------------------------------------------
event_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Poll;
@ -141,6 +142,7 @@ fn main() {
.expect("Failed to prepare frame");
let ui = imgui.frame();
// --- Actual drawing code ----------------------------------------------
{
let window = imgui::Window::new(im_str!("Hello implot"));
let window = if make_fullscreen {
@ -195,6 +197,7 @@ fn main() {
implot::show_demo_window(&mut showing_demo);
}
// --- Post-drawing rendering code --------------------------------------
let mut encoder: wgpu::CommandEncoder =
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });