Skip to content

Commit

Permalink
Merge pull request #9 from MFEK/sdl2-opengl-linux
Browse files Browse the repository at this point in the history
Fix SDL2 OpenGL example on GNU/Linux
  • Loading branch information
lucasmerlin authored Mar 16, 2023
2 parents 7725f3e + e67ee57 commit 33c24a8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/sdl2_opengl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@ fn main() {

// Unlike the other example above, nobody created a context for your window, so you need to create one.
let _ctx = window.gl_create_context().unwrap();
gl::load_with(|name| video_subsystem.gl_get_proc_address(name) as *const _);

debug_assert_eq!(gl_attr.context_profile(), GLProfile::Core);
debug_assert_eq!(gl_attr.context_version(), (3, 3));
gl::load_with(|name| video_subsystem.gl_get_proc_address(name) as *const _);

let interface = skia_safe::gpu::gl::Interface::new_load_with(|name| {
if name == "eglGetCurrentDisplay" {
return std::ptr::null();
}
video_subsystem.gl_get_proc_address(name) as *const _
})
.expect("Could not create interface");

let mut gr_context = skia_safe::gpu::DirectContext::new_gl(None, None).unwrap();
let mut gr_context = skia_safe::gpu::DirectContext::new_gl(Some(interface), None).unwrap();

let fb_info = {
let mut fboid = 0;
Expand Down

0 comments on commit 33c24a8

Please sign in to comment.