Mercurial > mplayer.hg
changeset 16111:5683110fce0a
Use dlsym to get glXGetProcAddress, only way to (hopefully) make it
compile everywhere since the gl/glx headers are such a mess...
author | reimar |
---|---|
date | Tue, 26 Jul 2005 18:28:51 +0000 |
parents | 82990d1dce53 |
children | 0aeb954fc11c |
files | libvo/gl_common.c |
diffstat | 1 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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