From 6b5c4b9aec188803ce49ab396634174efc3a7b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrique=20Penteado=20Kujawski=20P=C3=A9rigo?= Date: Sat, 27 Nov 2021 05:44:23 -0500 Subject: [PATCH] Disable glow scissor test after painting (#905) --- egui_glow/examples/pure_glow.rs | 6 ++++-- egui_glow/src/painter.rs | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/egui_glow/examples/pure_glow.rs b/egui_glow/examples/pure_glow.rs index 70f8c1c1..a4b04f48 100644 --- a/egui_glow/examples/pure_glow.rs +++ b/egui_glow/examples/pure_glow.rs @@ -37,6 +37,8 @@ fn create_display( } fn main() { + let mut clear_color = [0.1, 0.1, 0.1]; + let event_loop = glutin::event_loop::EventLoop::with_user_event(); let (gl_window, gl) = create_display(&event_loop); @@ -52,6 +54,7 @@ fn main() { if ui.button("Quit").clicked() { quit = true; } + ui.color_edit_button_rgb(&mut clear_color); }); }); @@ -65,10 +68,9 @@ fn main() { }; { - let color = egui::Rgba::from_rgb(0.1, 0.3, 0.2); unsafe { use glow::HasContext as _; - gl.clear_color(color[0], color[1], color[2], color[3]); + gl.clear_color(clear_color[0], clear_color[1], clear_color[2], 1.0); gl.clear(glow::COLOR_BUFFER_BIT); } diff --git a/egui_glow/src/painter.rs b/egui_glow/src/painter.rs index 550de486..5fb62c3e 100644 --- a/egui_glow/src/painter.rs +++ b/egui_glow/src/painter.rs @@ -265,7 +265,6 @@ impl Painter { let height_in_points = height_in_pixels as f32 / pixels_per_point; gl.viewport(0, 0, width_in_pixels as i32, height_in_pixels as i32); - gl.use_program(Some(self.program)); gl.uniform_2_f32(Some(&self.u_screen_size), width_in_points, height_in_points); @@ -324,6 +323,9 @@ impl Painter { if let Some(ref post_process) = self.post_process { post_process.end(gl); } + + gl.disable(glow::SCISSOR_TEST); + assert_eq!(glow::NO_ERROR, gl.get_error(), "GL error occurred!"); } }