From fe1adfceec62ea2fac274ec4bca1ba0918cc80b8 Mon Sep 17 00:00:00 2001 From: Zachary Lund Date: Thu, 6 Feb 2014 01:29:07 -0600 Subject: [PATCH] Broke Windows, here's a fix. --- libobs-opengl/GL/gl_obs.c | 15 ++++++++++++++- libobs-opengl/GL/glx_obs.c | 15 ++++++++++++++- libobs-opengl/GL/wgl_obs.c | 15 ++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/libobs-opengl/GL/gl_obs.c b/libobs-opengl/GL/gl_obs.c index 906953913..cd9cecb09 100644 --- a/libobs-opengl/GL/gl_obs.c +++ b/libobs-opengl/GL/gl_obs.c @@ -26,7 +26,20 @@ static void* AppleGLGetProcAddress (const const char *name) #pragma warning(disable: 4996) #endif -#define IntGetProcAddress(name) wglGetProcAddress((LPCSTR)name) +static PROC WinGetProcAddress(const char *name) +{ + static HMODULE glMod = NULL; + PROC pFunc = wglGetProcAddress((LPCSTR)name); + + if (pFunc) return pFunc; + + if (NULL == glMod) + glMod = GetModuleHandleA("OpenGL32.dll"); + + return (PROC)GetProcAddress(glMod, (LPCSTR)name); +} + +#define IntGetProcAddress(name) WinGetProcAddress(name) #endif /* Linux, FreeBSD, other */ diff --git a/libobs-opengl/GL/glx_obs.c b/libobs-opengl/GL/glx_obs.c index 9e741a3be..7fa8033d8 100644 --- a/libobs-opengl/GL/glx_obs.c +++ b/libobs-opengl/GL/glx_obs.c @@ -26,7 +26,20 @@ static void* AppleGLGetProcAddress (const const char *name) #pragma warning(disable: 4996) #endif -#define IntGetProcAddress(name) wglGetProcAddress((LPCSTR)name) +static PROC WinGetProcAddress(const char *name) +{ + static HMODULE glMod = NULL; + PROC pFunc = wglGetProcAddress((LPCSTR)name); + + if (pFunc) return pFunc; + + if (NULL == glMod) + glMod = GetModuleHandleA("OpenGL32.dll"); + + return (PROC)GetProcAddress(glMod, (LPCSTR)name); +} + +#define IntGetProcAddress(name) WinGetProcAddress(name) #endif /* Linux, FreeBSD, other */ diff --git a/libobs-opengl/GL/wgl_obs.c b/libobs-opengl/GL/wgl_obs.c index f6b50cf8c..53fc68741 100644 --- a/libobs-opengl/GL/wgl_obs.c +++ b/libobs-opengl/GL/wgl_obs.c @@ -26,7 +26,20 @@ static void* AppleGLGetProcAddress (const const char *name) #pragma warning(disable: 4996) #endif -#define IntGetProcAddress(name) wglGetProcAddress((LPCSTR)name) +static PROC WinGetProcAddress(const char *name) +{ + static HMODULE glMod = NULL; + PROC pFunc = wglGetProcAddress((LPCSTR)name); + + if (pFunc) return pFunc; + + if (NULL == glMod) + glMod = GetModuleHandleA("OpenGL32.dll"); + + return (PROC)GetProcAddress(glMod, (LPCSTR)name); +} + +#define IntGetProcAddress(name) WinGetProcAddress(name) #endif /* Linux, FreeBSD, other */