From e369626d3db4e8a6dd55fd10b224a3835b4040f9 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sun, 20 Mar 2022 23:04:44 +0100 Subject: [PATCH] glow: move where FRAMEBUFFER_SRGB is enabled --- egui_glow/examples/pure_glow.rs | 5 ----- egui_glow/src/epi_backend.rs | 5 ----- egui_glow/src/painter.rs | 5 +++++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/egui_glow/examples/pure_glow.rs b/egui_glow/examples/pure_glow.rs index 4b832878c54..06abc5c29ae 100644 --- a/egui_glow/examples/pure_glow.rs +++ b/egui_glow/examples/pure_glow.rs @@ -109,10 +109,5 @@ fn create_display( let gl = unsafe { glow::Context::from_loader_function(|s| gl_window.get_proc_address(s)) }; - unsafe { - use glow::HasContext as _; - gl.enable(glow::FRAMEBUFFER_SRGB); - } - (gl_window, gl) } diff --git a/egui_glow/src/epi_backend.rs b/egui_glow/src/epi_backend.rs index 32705bf25aa..72611673268 100644 --- a/egui_glow/src/epi_backend.rs +++ b/egui_glow/src/epi_backend.rs @@ -25,11 +25,6 @@ fn create_display( let gl = unsafe { glow::Context::from_loader_function(|s| gl_window.get_proc_address(s)) }; - unsafe { - use glow::HasContext as _; - gl.enable(glow::FRAMEBUFFER_SRGB); - } - (gl_window, gl) } diff --git a/egui_glow/src/painter.rs b/egui_glow/src/painter.rs index db24433be91..804bc19ed66 100644 --- a/egui_glow/src/painter.rs +++ b/egui_glow/src/painter.rs @@ -264,6 +264,11 @@ impl Painter { glow::ONE, ); + if !cfg!(target_arch = "wasm32") { + self.gl.enable(glow::FRAMEBUFFER_SRGB); + check_for_gl_error(&self.gl, "FRAMEBUFFER_SRGB"); + } + let width_in_points = width_in_pixels as f32 / pixels_per_point; let height_in_points = height_in_pixels as f32 / pixels_per_point;