summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-26 18:28:51 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-26 18:28:51 +0000
commit58eab3c0548b2b198799457d991c86352400b5e7 (patch)
tree2309264b5bd33ae8797e9b6ee6c3fce7691eae3f /libvo
parent79347ed3f796db0422eba8d9507faf6de3ad35ff (diff)
downloadmpv-58eab3c0548b2b198799457d991c86352400b5e7.tar.bz2
mpv-58eab3c0548b2b198799457d991c86352400b5e7.tar.xz
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
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 2c3b9ebcc6..20e39b9af1 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -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