From a1d62bbb620908ad657af11004ffb4c779539791 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 19 Nov 2005 14:00:35 +0000 Subject: Also parse glX extension string, makes -vo gl:swapinterval work again on linux git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17020 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index f23d0728e6..0681a99a82 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -249,9 +249,13 @@ static void *setNull(const GLubyte *s) { /** * \brief find the function pointers of some useful OpenGL extensions * \param getProcAddress function to resolve function names, may be NULL + * \param ext2 an extra extension string */ -static void getFunctions(void *(*getProcAddress)(const GLubyte *)) { +static void getFunctions(void *(*getProcAddress)(const GLubyte *), + const char *ext2) { const char *extensions = glGetString(GL_EXTENSIONS); + if (!extensions) extensions = ""; + if (!ext2) ext2 = ""; if (!getProcAddress) getProcAddress = setNull; GenBuffers = getProcAddress("glGenBuffers"); @@ -324,7 +328,7 @@ static void getFunctions(void *(*getProcAddress)(const GLubyte *)) { ProgramEnvParameter4f = getProcAddress("glProgramEnvParameter4fARB"); if (!ProgramEnvParameter4f) ProgramEnvParameter4f = getProcAddress("glProgramEnvParameter4fNV"); - if (!extensions || !strstr(extensions, "_swap_control")) + if (!strstr(extensions, "_swap_control") && !strstr(ext2, "_swap_control")) SwapInterval = NULL; else { SwapInterval = getProcAddress("glXSwapInterval"); @@ -1003,7 +1007,7 @@ int setGlWindow(int *vinfo, HGLRC *context, HWND win) wglDeleteContext(*context); *context = new_context; *vinfo = new_vinfo; - getFunctions(w32gpa); + getFunctions(w32gpa, NULL); // and inform that reinit is neccessary return SET_WINDOW_REINIT; @@ -1117,6 +1121,7 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win) } if (!keep_context) { void *(*getProcAddress)(const GLubyte *); + const char *(*glXExtStr)(Display *, int); if (*context) glXDestroyContext(mDisplay, *context); *context = new_context; @@ -1128,7 +1133,9 @@ int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win) getProcAddress = getdladdr("glXGetProcAddressARB"); if (!getProcAddress) getProcAddress = getdladdr; - getFunctions(getProcAddress); + glXExtStr = getdladdr("glXQueryExtensionsString"); + getFunctions(getProcAddress, !glXExtStr ? NULL : + glXExtStr(mDisplay, DefaultScreen(mDisplay))); // and inform that reinit is neccessary return SET_WINDOW_REINIT; -- cgit v1.2.3