Skip to content

Commit

Permalink
Disable glow scissor test after painting (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hperigo authored Nov 27, 2021
1 parent 5fee6b7 commit 6b5c4b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions egui_glow/examples/pure_glow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -52,6 +54,7 @@ fn main() {
if ui.button("Quit").clicked() {
quit = true;
}
ui.color_edit_button_rgb(&mut clear_color);
});
});

Expand All @@ -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);
}

Expand Down
4 changes: 3 additions & 1 deletion egui_glow/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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!");
}
}
Expand Down

0 comments on commit 6b5c4b9

Please sign in to comment.