changeset 16588:c3dc7f3c716c

get rid of global getProcAddress variable
author reimar
date Sun, 25 Sep 2005 16:12:01 +0000
parents 3b108342a983
children c991500a54c7
files libvo/gl_common.c
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Sun Sep 25 16:11:21 2005 +0000
+++ b/libvo/gl_common.c	Sun Sep 25 16:12:01 2005 +0000
@@ -213,12 +213,11 @@
   return NULL;
 }
 
-static void *(*getProcAddress)(const GLubyte *procName) = NULL;
-
 /**
  * \brief find the function pointers of some useful OpenGL extensions
+ * \param getProcAddress function to resolve function names, may be NULL
  */
-static void getFunctions() {
+static void getFunctions(void *(*getProcAddress)(const GLubyte *)) {
   if (!getProcAddress)
     getProcAddress = setNull;
   GenBuffers = getProcAddress("glGenBuffers");
@@ -794,8 +793,7 @@
       wglDeleteContext(*context);
     *context = new_context;
     *vinfo = new_vinfo;
-    getProcAddress = w32gpa;
-    getFunctions();
+    getFunctions(w32gpa);
 
     // and inform that reinit is neccessary
     return SET_WINDOW_REINIT;
@@ -906,19 +904,19 @@
                   &vo_dwidth, &vo_dheight, &tmp, &tmp);
   }
   if (!keep_context) {
+    void *(*getProcAddress)(const GLubyte *);
     if (*context)
       glXDestroyContext(mDisplay, *context);
     *context = new_context;
     if (*vinfo)
       XFree(*vinfo);
     *vinfo = new_vinfo;
-    if (!getProcAddress)
       getProcAddress = getdladdr("glXGetProcAddress");
     if (!getProcAddress)
       getProcAddress = getdladdr("glXGetProcAddressARB");
     if (!getProcAddress)
       getProcAddress = getdladdr;
-    getFunctions();
+    getFunctions(getProcAddress);
 
     // and inform that reinit is neccessary
     return SET_WINDOW_REINIT;