#elif defined( __APPLE__ )
#else
- int minor, major;
- _pDisplay = glXGetCurrentDisplay();
- if (!glXQueryVersion(_pDisplay, &major, &minor))
- return false;
-
- glXVersion1_3Present = major >= 1 && minor >= 3;
- if (glXVersion1_3Present)
- {
- glXChooseFBConfigPtr = (glXChooseFBConfigProc)SGLookupFunction("glXChooseFBConfig");
- glXCreateGLXPbufferPtr = (glXCreateGLXPbufferProc)SGLookupFunction("glXCreatePbuffer");
- glXGetVisualFromFBConfigPtr = (glXGetVisualFromFBConfigProc)SGLookupFunction("glXGetVisualFromFBConfig");
- glXCreateContextPtr = (glXCreateContextProc)SGLookupFunction("glXCreateContext");
- glXDestroyPbufferPtr = (glXDestroyPbufferProc)SGLookupFunction("glXDestroyPbuffer");
- glXQueryDrawablePtr = (glXQueryDrawableProc)SGLookupFunction("glXQueryDrawable");
-
- if (!glXChooseFBConfigPtr ||
- !glXCreateGLXPbufferPtr ||
- !glXGetVisualFromFBConfigPtr ||
- !glXCreateContextPtr ||
- !glXDestroyPbufferPtr ||
- !glXQueryDrawablePtr)
- return false;
- }
+ // First try the glX version 1.3 functions.
+ glXChooseFBConfigPtr = (glXChooseFBConfigProc)SGLookupFunction("glXChooseFBConfig");
+ glXCreateGLXPbufferPtr = (glXCreateGLXPbufferProc)SGLookupFunction("glXCreatePbuffer");
+ glXGetVisualFromFBConfigPtr = (glXGetVisualFromFBConfigProc)SGLookupFunction("glXGetVisualFromFBConfig");
+ glXCreateContextPtr = (glXCreateContextProc)SGLookupFunction("glXCreateContext");
+ glXDestroyPbufferPtr = (glXDestroyPbufferProc)SGLookupFunction("glXDestroyPbuffer");
+ glXQueryDrawablePtr = (glXQueryDrawableProc)SGLookupFunction("glXQueryDrawable");
+
+ if (glXChooseFBConfigPtr &&
+ glXCreateGLXPbufferPtr &&
+ glXGetVisualFromFBConfigPtr &&
+ glXCreateContextPtr &&
+ glXDestroyPbufferPtr &&
+ glXQueryDrawablePtr)
+ glXVersion1_3Present = true;
else
{
glXChooseFBConfigPtr = (glXChooseFBConfigProc)SGLookupFunction("glXChooseFBConfigSGIX");
return false;
}
-// if (!GLX_SGIX_pbuffer)
-// {
-// PrintExtensionError("GL_SGIX_pbuffer");
-// return false;
-// }
-// if (!GLX_SGIX_fbconfig)
-// {
-// PrintExtensionError("GLX_SGIX_fbconfig");
-// return false;
-// }
if (_bIsDepthTexture && !GL_ARB_depth_texture)
{
PrintExtensionError("GL_ARB_depth_texture");
*/
dlerror();
+ /*
+ * Since libGL must be linked to the binary we run on, this is the
+ * right handle. That 'current binary' handle also avoids conflicts which
+ * arise from linking with a different libGL at link time an than later
+ * use the standard libGL at runtime ...
+ */
if (libHandle == NULL)
- libHandle = dlopen("libGL.so", RTLD_LAZY);
-
- if (libHandle == NULL)
- libHandle = dlopen("libGL.so.1", RTLD_LAZY);
+ libHandle = dlopen(NULL, RTLD_LAZY);
if (libHandle != NULL) {
fptr = dlsym(libHandle, func);