X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glws_egl_xlib.cpp;h=e383a532cd2e9eea00820414db5ebe1bd81c790e;hb=dfa23ba3320555bb32ee964e20f83d498132bcb7;hp=eb284ab031ea198053ffb384f29089657146e671;hpb=1cfd89b2bb73c94340d61936a72bec346c3ca22d;p=apitrace diff --git a/glws_egl_xlib.cpp b/glws_egl_xlib.cpp index eb284ab..e383a53 100644 --- a/glws_egl_xlib.cpp +++ b/glws_egl_xlib.cpp @@ -137,7 +137,7 @@ public: eglWaitNative(EGL_CORE_NATIVE_ENGINE); EGLConfig config = static_cast(visual)->config; - surface = eglCreateWindowSurface(eglDisplay, config, window, NULL); + surface = eglCreateWindowSurface(eglDisplay, config, (EGLNativeWindowType)window, NULL); } void waitForEvent(int type) { @@ -220,8 +220,23 @@ public: } }; +/** + * Load the symbols from the specified shared object into global namespace, so + * that they can be later found by dlsym(RTLD_NEXT, ...); + */ +static void +load(const char *filename) +{ + if (!dlopen(filename, RTLD_GLOBAL | RTLD_LAZY)) { + std::cerr << "error: unable to open " << filename << "\n"; + exit(1); + } +} + void init(void) { + load("libEGL.so.1"); + display = XOpenDisplay(NULL); if (!display) { std::cerr << "error: unable to open display " << XDisplayName(NULL) << "\n"; @@ -230,14 +245,7 @@ init(void) { screen = DefaultScreen(display); - __libGlHandle = dlopen("libEGL.so", RTLD_GLOBAL | RTLD_LAZY); - if (!__libGlHandle) { - std::cerr << "error: unable to open libEGL.so\n"; - XCloseDisplay(display); - exit(1); - } - - eglDisplay = eglGetDisplay(display); + eglDisplay = eglGetDisplay((EGLNativeDisplayType)display); if (eglDisplay == EGL_NO_DISPLAY) { std::cerr << "error: unable to get EGL display\n"; XCloseDisplay(display); @@ -328,12 +336,18 @@ createContext(const Visual *_visual, Context *shareContext, Profile profile) switch (profile) { case PROFILE_COMPAT: + load("libGL.so.1"); eglBindAPI(EGL_OPENGL_API); break; + case PROFILE_CORE: + assert(0); + return NULL; case PROFILE_ES1: + load("libGLESv1_CM.so.1"); eglBindAPI(EGL_OPENGL_ES_API); break; case PROFILE_ES2: + load("libGLESv2.so.2"); eglBindAPI(EGL_OPENGL_ES_API); attribs.add(EGL_CONTEXT_CLIENT_VERSION, 2); break;