From 969de1d31ce7c17f297b2b8abffd071caa562646 Mon Sep 17 00:00:00 2001 From: hatoo Date: Wed, 3 Jun 2020 22:01:28 +0900 Subject: Add a comment of how to clear the display to `integration` example --- examples/integration/src/main.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'examples/integration/src/main.rs') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 6b4aa968..2206d906 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -163,6 +163,29 @@ pub fn main() { program.background_color(), ); + // If you are using this example and you have no `scene` on your application, + // you can clear screen by this code. + /* + let _ = + encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + color_attachments: &[ + wgpu::RenderPassColorAttachmentDescriptor { + attachment: &frame.view, + resolve_target: None, + load_op: wgpu::LoadOp::Clear, + store_op: wgpu::StoreOp::Store, + clear_color: wgpu::Color { + r: 1.0, + g: 1.0, + b: 1.0, + a: 1.0, + }, + }, + ], + depth_stencil_attachment: None, + }); + */ + // And then iced on top let mouse_interaction = renderer.backend_mut().draw( &mut device, -- cgit From fd3801ed38a5adbba11ede16f552cd80c0a8bb58 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 5 Jun 2020 15:05:30 +0200 Subject: Clear frames explicitly in `integration` example --- examples/integration/src/main.rs | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'examples/integration/src/main.rs') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 2206d906..db8b4366 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -154,37 +154,19 @@ pub fn main() { &wgpu::CommandEncoderDescriptor { label: None }, ); - // We draw the scene first let program = state.program(); - scene.draw( - &mut encoder, - &frame.view, - program.background_color(), - ); + { + // We clear the frame + let mut render_pass = scene.clear( + &frame.view, + &mut encoder, + program.background_color(), + ); - // If you are using this example and you have no `scene` on your application, - // you can clear screen by this code. - /* - let _ = - encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - color_attachments: &[ - wgpu::RenderPassColorAttachmentDescriptor { - attachment: &frame.view, - resolve_target: None, - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_color: wgpu::Color { - r: 1.0, - g: 1.0, - b: 1.0, - a: 1.0, - }, - }, - ], - depth_stencil_attachment: None, - }); - */ + // Draw the scene + scene.draw(&mut render_pass); + } // And then iced on top let mouse_interaction = renderer.backend_mut().draw( -- cgit