Mathias Frhlich:
just a few split out patches from my zoo of local work ... The patch to simgear-glxproc.diff changes dlopen to not open a specific library. If it is used with a NULL argument, we just get a handle to the current running binary including all loaded libraries. This has the advantage that we do not rely on the name of libGL on the specific platform. Also a user can link with his own different named libGL or with a static libGL.a Then the render texture again ... glxQueryVersion turns out to return the minimum of the client libraries glx version and the servers glx version. *All* Xorg servers return 1.2 here. So we never get the glxPBuffer functions which are the only ones working with ati's drivers ... Reverted back to checking the required functions and just use them if they are there. Still prefering the glx standard variants since they work on ati's drivers ...
This commit is contained in:
@@ -1821,29 +1821,21 @@ bool RenderTexture::_VerifyExtensions()
|
||||
#elif defined( __APPLE__ )
|
||||
#else
|
||||
|
||||
int minor, major;
|
||||
_pDisplay = glXGetCurrentDisplay();
|
||||
if (!glXQueryVersion(_pDisplay, &major, &minor))
|
||||
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");
|
||||
|
||||
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;
|
||||
}
|
||||
if (glXChooseFBConfigPtr &&
|
||||
glXCreateGLXPbufferPtr &&
|
||||
glXGetVisualFromFBConfigPtr &&
|
||||
glXCreateContextPtr &&
|
||||
glXDestroyPbufferPtr &&
|
||||
glXQueryDrawablePtr)
|
||||
glXVersion1_3Present = true;
|
||||
else
|
||||
{
|
||||
glXChooseFBConfigPtr = (glXChooseFBConfigProc)SGLookupFunction("glXChooseFBConfigSGIX");
|
||||
@@ -1863,16 +1855,6 @@ bool RenderTexture::_VerifyExtensions()
|
||||
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");
|
||||
|
||||
@@ -107,11 +107,14 @@ void *SGGetGLProcAddress(const char *func) {
|
||||
*/
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user