From eab6d9a9d1004bef338939ad46b374eb7e60f83b Mon Sep 17 00:00:00 2001 From: 4bb4 <67376761+4bb4@users.noreply.github.com> Date: Fri, 30 Oct 2020 12:51:57 +0100 Subject: [PATCH] Added some comments, updated README with progress notes --- implot-examples/README.md | 7 ++++--- implot-examples/implot-wgpu-examples/Cargo.toml | 3 ++- implot-examples/implot-wgpu-examples/src/main.rs | 7 +++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/implot-examples/README.md b/implot-examples/README.md index 5637f1e..e3f1e0e 100644 --- a/implot-examples/README.md +++ b/implot-examples/README.md @@ -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. diff --git a/implot-examples/implot-wgpu-examples/Cargo.toml b/implot-examples/implot-wgpu-examples/Cargo.toml index d19c0b6..11ac9d2 100644 --- a/implot-examples/implot-wgpu-examples/Cargo.toml +++ b/implot-examples/implot-wgpu-examples/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Benedikt Mandelkow ", "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" } diff --git a/implot-examples/implot-wgpu-examples/src/main.rs b/implot-examples/implot-wgpu-examples/src/main.rs index 1c483de..e6412ea 100644 --- a/implot-examples/implot-wgpu-examples/src/main.rs +++ b/implot-examples/implot-wgpu-examples/src/main.rs @@ -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 });