From d06ea270be05df33769eb73ccf347ba551a7c2e5 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Sep 2005 16:12:01 +0000 Subject: [PATCH] get rid of global getProcAddress variable git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16589 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 2ca28c3fa3..936c4618a3 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -213,12 +213,11 @@ static void *setNull(const GLubyte *s) { 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 @@ int setGlWindow(int *vinfo, HGLRC *context, HWND win) 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 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win) &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;