From 1983d1961435bda723858d0c30d3657a0664a6f6 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 30 Apr 2022 15:42:35 +0200 Subject: [PATCH] eframe: fix wrong clear color on native --- egui_glow/src/painter.rs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/egui_glow/src/painter.rs b/egui_glow/src/painter.rs index 68d374ff..ed9592da 100644 --- a/egui_glow/src/painter.rs +++ b/egui_glow/src/painter.rs @@ -659,13 +659,23 @@ pub fn clear(gl: &glow::Context, screen_size_in_pixels: [u32; 2], clear_color: e screen_size_in_pixels[1] as i32, ); - let clear_color: Color32 = clear_color.into(); - gl.clear_color( - clear_color[0] as f32 / 255.0, - clear_color[1] as f32 / 255.0, - clear_color[2] as f32 / 255.0, - clear_color[3] as f32 / 255.0, - ); + if true { + // verified to be correct on eframe native (on Mac). + gl.clear_color( + clear_color[0] as f32, + clear_color[1] as f32, + clear_color[2] as f32, + clear_color[3] as f32, + ); + } else { + let clear_color: Color32 = clear_color.into(); + gl.clear_color( + clear_color[0] as f32 / 255.0, + clear_color[1] as f32 / 255.0, + clear_color[2] as f32 / 255.0, + clear_color[3] as f32 / 255.0, + ); + } gl.clear(glow::COLOR_BUFFER_BIT); } }