mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
Use dlsym to get glXGetProcAddress, only way to (hopefully) make it
compile everywhere since the gl/glx headers are such a mess... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16112 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
79347ed3f7
commit
58eab3c054
@ -201,7 +201,7 @@ static void *setNull(const GLubyte *s) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *(*getProcAddress)(const GLubyte *procName);
|
||||
static void *(*getProcAddress)(const GLubyte *procName) = NULL;
|
||||
|
||||
static void getFunctions() {
|
||||
if (!getProcAddress)
|
||||
@ -326,6 +326,26 @@ void releaseGlContext(int *vinfo, HGLRC *context) {
|
||||
*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 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user