Dynamically load some of the used GLX symbols and make sure they exist before

initing gl mode.

svn path=/trunk/KDE/kdebase/workspace/; revision=721561
This commit is contained in:
Rivo Laks 2007-10-05 14:10:13 +00:00
parent e52b015a33
commit aa0e5c7773
3 changed files with 46 additions and 2 deletions

View file

@ -39,6 +39,15 @@ glXCopySubBuffer_func glXCopySubBuffer;
// video_sync extension functions
glXGetVideoSync_func glXGetVideoSync;
glXWaitVideoSync_func glXWaitVideoSync;
// GLX_SGIX_fbconfig
glXGetFBConfigAttrib_func glXGetFBConfigAttrib;
glXGetVisualFromFBConfig_func glXGetVisualFromFBConfig;
glXCreateWindow_func glXCreateWindow;
glXDestroyWindow_func glXDestroyWindow;
glXCreatePixmap_func glXCreatePixmap;
glXDestroyPixmap_func glXDestroyPixmap;
glXGetFBConfigs_func glXGetFBConfigs;
// glActiveTexture
glActiveTexture_func glActiveTexture;
// framebuffer_object extension functions
@ -124,6 +133,14 @@ void glxResolveFunctions()
glXGetVideoSync = NULL;
glXWaitVideoSync = NULL;
}
GL_RESOLVE_WITH_EXT( glXGetFBConfigAttrib, glXGetFBConfigAttribSGIX );
GL_RESOLVE_WITH_EXT( glXGetVisualFromFBConfig, glXGetVisualFromFBConfigSGIX );
GL_RESOLVE( glXGetFBConfigs );
GL_RESOLVE( glXCreateWindow );
GL_RESOLVE( glXDestroyWindow );
GL_RESOLVE( glXCreatePixmap );
GL_RESOLVE( glXDestroyPixmap );
}
void glResolveFunctions()

View file

@ -129,6 +129,12 @@ void KWIN_EXPORT glResolveFunctions();
#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
// GLX typedefs
typedef struct __GLXcontextRec *GLXContext;
/* GLX 1.3 and later */
typedef struct __GLXFBConfigRec *GLXFBConfig;
// GL typedefs
typedef char GLchar;
// Function pointers
@ -154,6 +160,25 @@ typedef void (*glXGetVideoSync_func)( unsigned int *count );
typedef void (*glXWaitVideoSync_func)( int divisor, int remainder, unsigned int *count );
extern KWIN_EXPORT glXGetVideoSync_func glXGetVideoSync;
extern KWIN_EXPORT glXWaitVideoSync_func glXWaitVideoSync;
// GLX_SGIX_fbconfig and misc GLX 1.3 stuff
typedef int (*glXGetFBConfigAttrib_func) ( Display *dpy, GLXFBConfig config,
int attribute, int *value );
typedef XVisualInfo* (*glXGetVisualFromFBConfig_func) ( Display *dpy, GLXFBConfig config );
extern KWIN_EXPORT glXGetFBConfigAttrib_func glXGetFBConfigAttrib;
extern KWIN_EXPORT glXGetVisualFromFBConfig_func glXGetVisualFromFBConfig;
typedef GLXWindow (*glXCreateWindow_func) ( Display *dpy, GLXFBConfig config,
Window win, const int *attribList );
typedef void (*glXDestroyWindow_func) ( Display *dpy, GLXWindow window );
typedef GLXPixmap (*glXCreatePixmap_func) ( Display *dpy, GLXFBConfig config,
Pixmap pixmap, const int *attribList );
typedef void (*glXDestroyPixmap_func) ( Display *dpy, GLXPixmap pixmap );
typedef GLXFBConfig* (*glXGetFBConfigs_func) ( Display *dpy, int screen, int *nelements );
extern KWIN_EXPORT glXCreateWindow_func glXCreateWindow;
extern KWIN_EXPORT glXDestroyWindow_func glXDestroyWindow;
extern KWIN_EXPORT glXCreatePixmap_func glXCreatePixmap;
extern KWIN_EXPORT glXDestroyPixmap_func glXDestroyPixmap;
extern KWIN_EXPORT glXGetFBConfigs_func glXGetFBConfigs;
// glActiveTexture
typedef void (*glActiveTexture_func)(GLenum);
extern KWIN_EXPORT glActiveTexture_func glActiveTexture;

View file

@ -110,9 +110,11 @@ SceneOpenGL::SceneOpenGL( Workspace* ws )
}
initGLX();
// check for FBConfig support
if( !hasGLXVersion( 1, 3 ) && !hasGLExtension( "GLX_SGIX_fbconfig" ))
if( !hasGLExtension( "GLX_SGIX_fbconfig" ) || !glXGetFBConfigAttrib || !glXGetFBConfigs ||
!glXGetVisualFromFBConfig || !glXCreatePixmap || !glXDestroyPixmap ||
!glXCreateWindow || !glXDestroyWindow )
{
kDebug( 1212 ) << "GLX1.3 or GLX_SGIX_fbconfig missing";
kDebug( 1212 ) << "GLX_SGIX_fbconfig or required GLX functions missing";
return; // error
}
if( !selectMode())