1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Fix bugs in glow on web (#1092)

* Re-add check of WEBGL_debug_renderer_info to avoid OpenGL error

I removed this check in https://github.com/emilk/egui/pull/1020
because it produced a warning on Firefox. Better a warning
than an OpenGL error though.

* Bug fix: don't ask for webgl context and then later for webgl2 context

The browser will only allow the first thing we check, so this will
prevent webgl2 from working.
This commit is contained in:
Emil Ernerfeldt
2022-01-10 23:19:30 +01:00
committed by GitHub
parent d5673412dd
commit 205e04aa18
8 changed files with 83 additions and 81 deletions

View File

@@ -475,13 +475,6 @@ struct PostProcess {
program: WebGlProgram,
}
fn requires_brightening(gl: &web_sys::WebGlRenderingContext) -> bool {
// See https://github.com/emilk/egui/issues/794
let user_agent = web_sys::window().unwrap().navigator().user_agent().unwrap();
crate::is_safari_and_webkit_gtk(gl) && !user_agent.contains("Mac OS X")
}
impl PostProcess {
fn new(gl: Gl, width: i32, height: i32) -> Result<PostProcess, JsValue> {
let fbo = gl
@@ -519,7 +512,7 @@ impl PostProcess {
gl.bind_texture(Gl::TEXTURE_2D, None);
gl.bind_framebuffer(Gl::FRAMEBUFFER, None);
let shader_prefix = if requires_brightening(&gl) {
let shader_prefix = if crate::webgl1_requires_brightening(&gl) {
crate::console_log("Enabling webkitGTK brightening workaround");
"#define APPLY_BRIGHTENING_GAMMA"
} else {