Skip to content

Commit 6b5c4b9

Browse files
authored
Disable glow scissor test after painting (#905)
1 parent 5fee6b7 commit 6b5c4b9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

egui_glow/examples/pure_glow.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ fn create_display(
3737
}
3838

3939
fn main() {
40+
let mut clear_color = [0.1, 0.1, 0.1];
41+
4042
let event_loop = glutin::event_loop::EventLoop::with_user_event();
4143
let (gl_window, gl) = create_display(&event_loop);
4244

@@ -52,6 +54,7 @@ fn main() {
5254
if ui.button("Quit").clicked() {
5355
quit = true;
5456
}
57+
ui.color_edit_button_rgb(&mut clear_color);
5558
});
5659
});
5760

@@ -65,10 +68,9 @@ fn main() {
6568
};
6669

6770
{
68-
let color = egui::Rgba::from_rgb(0.1, 0.3, 0.2);
6971
unsafe {
7072
use glow::HasContext as _;
71-
gl.clear_color(color[0], color[1], color[2], color[3]);
73+
gl.clear_color(clear_color[0], clear_color[1], clear_color[2], 1.0);
7274
gl.clear(glow::COLOR_BUFFER_BIT);
7375
}
7476

egui_glow/src/painter.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ impl Painter {
265265
let height_in_points = height_in_pixels as f32 / pixels_per_point;
266266

267267
gl.viewport(0, 0, width_in_pixels as i32, height_in_pixels as i32);
268-
269268
gl.use_program(Some(self.program));
270269

271270
gl.uniform_2_f32(Some(&self.u_screen_size), width_in_points, height_in_points);
@@ -324,6 +323,9 @@ impl Painter {
324323
if let Some(ref post_process) = self.post_process {
325324
post_process.end(gl);
326325
}
326+
327+
gl.disable(glow::SCISSOR_TEST);
328+
327329
assert_eq!(glow::NO_ERROR, gl.get_error(), "GL error occurred!");
328330
}
329331
}

0 commit comments

Comments
 (0)