From 519299b29dea63a0d7cdfdf81af3980d16118511 Mon Sep 17 00:00:00 2001 From: Guillaume Savaton Date: Sat, 11 Nov 2023 22:54:10 +0100 Subject: [PATCH] Fixed runtime error at GL context creation --- loopers-gui/src/skia.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/loopers-gui/src/skia.rs b/loopers-gui/src/skia.rs index 949bb6b..71d5e48 100644 --- a/loopers-gui/src/skia.rs +++ b/loopers-gui/src/skia.rs @@ -1,4 +1,4 @@ -use skia_safe::gpu::gl::FramebufferInfo; +use skia_safe::gpu::gl::{FramebufferInfo, Interface}; use skia_safe::gpu::{BackendRenderTarget, DirectContext, SurfaceOrigin}; use skia_safe::{ Color, ColorType, Font, Paint, PictureRecorder, Point, Rect, Size, Surface, TextBlob, Typeface, @@ -87,7 +87,14 @@ pub fn skia_main(mut gui: Gui) { let debug = std::env::var("DEBUG").is_ok(); - let mut gr_context = DirectContext::new_gl(None, None).unwrap(); + let interface = Interface::new_load_with(|name| { + if name == "eglGetCurrentDisplay" { + return std::ptr::null(); + } + video_subsystem.gl_get_proc_address(&name) as *const _ + }); + + let mut gr_context = DirectContext::new_gl(interface, None).unwrap(); let mut fboid: GLint = 0; unsafe { gl::GetIntegerv(gl::FRAMEBUFFER_BINDING, &mut fboid) };