From f9f7dcef1888040ced9167b2711210ad0f3497bd Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 1 Sep 2024 01:17:20 +0900 Subject: [PATCH] Update glow_integration.rs --- crates/eframe/src/native/glow_integration.rs | 43 +------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index 599420e597d..a8e1f3ea848 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -552,44 +552,6 @@ impl GlowWinitRunning { (raw_input, viewport_ui_cb) }; - let clear_color = self - .app - .clear_color(&self.integration.egui_ctx.style().visuals); - - let has_many_viewports = self.glutin.borrow().viewports.len() > 1; - let clear_before_update = !has_many_viewports; // HACK: for some reason, an early clear doesn't "take" on Mac with multiple viewports. - - if clear_before_update { - // clear before we call update, so users can paint between clear-color and egui windows: - - let mut glutin = self.glutin.borrow_mut(); - let GlutinWindowContext { - viewports, - current_gl_context, - not_current_gl_context, - .. - } = &mut *glutin; - let viewport = &viewports[&viewport_id]; - let Some(window) = viewport.window.as_ref() else { - return Ok(EventResult::Wait); - }; - let Some(gl_surface) = viewport.gl_surface.as_ref() else { - return Ok(EventResult::Wait); - }; - - let screen_size_in_pixels: [u32; 2] = window.inner_size().into(); - - { - frame_timer.pause(); - change_gl_context(current_gl_context, not_current_gl_context, gl_surface); - frame_timer.resume(); - } - - self.painter - .borrow() - .clear(screen_size_in_pixels, clear_color); - } - // ------------------------------------------------------------ // The update function, which could call immediate viewports, // so make sure we don't hold any locks here required by the immediate viewports rendeer. @@ -649,10 +611,9 @@ impl GlowWinitRunning { } let screen_size_in_pixels: [u32; 2] = window.inner_size().into(); + let clear_color = app.clear_color(&integration.egui_ctx.style().visuals); - if !clear_before_update { - painter.clear(screen_size_in_pixels, clear_color); - } + painter.clear(screen_size_in_pixels, clear_color); painter.paint_and_update_textures( screen_size_in_pixels,