Skip to content

Commit

Permalink
Linux: fix uiGLGetProcAddress()
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed May 31, 2019
1 parent 3e760a2 commit b9529e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ add_library(core STATIC
if (WIN32)
target_link_libraries(core ole32 comctl32 ws2_32 opengl32)
else()
target_link_libraries(core GL)
target_link_libraries(core GL EGL)
endif()
13 changes: 9 additions & 4 deletions src/libui_sdl/libui/unix/gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include "uipriv_unix.h"

#include <GL/gl.h>

void* glXGetProcAddressARB(const GLubyte* name);
#include <GL/glx.h>
#include <EGL/egl.h>

extern GThread* gtkthread;
extern GMutex glmutex;
Expand Down Expand Up @@ -220,10 +220,15 @@ void *uiGLGetProcAddress(const char* proc)
{
// TODO: consider using epoxy or something funny

void* ptr = dlsym(NULL /* RTLD_DEFAULT */, proc);
void* ptr;

ptr = glXGetProcAddressARB((const GLubyte*)proc);
if (ptr) return ptr;

ptr = eglGetProcAddress(proc);
if (ptr) return ptr;

ptr = glXGetProcAddressARB((const GLubyte*)proc);
ptr = dlsym(NULL /* RTLD_DEFAULT */, proc);
if (ptr) return ptr;

return NULL;
Expand Down

0 comments on commit b9529e8

Please sign in to comment.