# HG changeset patch # User reimar # Date 1122402531 0 # Node ID 5683110fce0a95cecd903d04858190df650681c6 # Parent 82990d1dce53260a8105ca317a47ad8a1ba8df7d Use dlsym to get glXGetProcAddress, only way to (hopefully) make it compile everywhere since the gl/glx headers are such a mess... diff -r 82990d1dce53 -r 5683110fce0a libvo/gl_common.c --- a/libvo/gl_common.c Tue Jul 26 14:32:17 2005 +0000 +++ b/libvo/gl_common.c Tue Jul 26 18:28:51 2005 +0000 @@ -201,7 +201,7 @@ return NULL; } -static void *(*getProcAddress)(const GLubyte *procName); +static void *(*getProcAddress)(const GLubyte *procName) = NULL; static void getFunctions() { if (!getProcAddress) @@ -326,6 +326,26 @@ *context = 0; } #else +#if defined(__sun) || defined(__sgi) +extern void *dlopen(const char *, int); +#endif +extern void *dlsym(void *, const char *); +/** + * \brief find address of a linked function + * \param s name of function to find + * \return address of function or NULL if not found + * + * Copied from xine + */ +static void *getdladdr(const GLubyte *s) { +#if defined(__sun) || defined(__sgi) + static void *handle = dlopen(NULL, RTLD_LAZY); + return dlsym(handle, s); +#else + return dlsym(0, s); +#endif +} + /** * \brief Returns the XVisualInfo associated with Window win. * \param win Window whose XVisualInfo is returne. @@ -403,11 +423,12 @@ if (*vinfo) XFree(*vinfo); *vinfo = new_vinfo; -#ifdef GLX_ARB_get_proc_address - getProcAddress = (void *)glXGetProcAddressARB; -#else - getProcAddress = NULL; -#endif + if (!getProcAddress) + getProcAddress = getdladdr("glXGetProcAddress"); + if (!getProcAddress) + getProcAddress = getdladdr("glXGetProcAddressARB"); + if (!getProcAddress) + getProcAddress = getdladdr; getFunctions(); // and inform that reinit is neccessary