Skip to content

Commit

Permalink
Reapply 787794d, e5124df over previous commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed May 7, 2024
1 parent 7a7d986 commit 7e48489
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion template/gl3w.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,12 @@ static int open_libs(void)
close_libgl();
}

if (is_library_loaded("libGL.so", &libgl))
return GL3W_OK;
if (is_library_loaded("libGL.so.1", &libgl))
return GL3W_OK;
if (is_library_loaded("libGL.so.3", &libgl))
return GL3W_OK;

// Neither is already loaded, so we have to load one. Try EGL first
// because it is supported under both X11 and Wayland.
Expand All @@ -247,7 +251,12 @@ static int open_libs(void)
close_libgl();

// Fall back to legacy libGL, which includes GLX
libgl = dlopen("libGL.so.1", RTLD_LAZY | RTLD_LOCAL);
// While most systems use libGL.so.1, NetBSD seems to use that libGL.so.3. See https://github.com/ocornut/imgui/issues/6983
libgl = dlopen("libGL.so", RTLD_LAZY | RTLD_LOCAL);
if (!libgl)
libgl = dlopen("libGL.so.1", RTLD_LAZY | RTLD_LOCAL);
if (!libgl)
libgl = dlopen("libGL.so.3", RTLD_LAZY | RTLD_LOCAL);

if (libgl)
return GL3W_OK;
Expand Down

0 comments on commit 7e48489

Please sign in to comment.