Browse Source

Broke Windows, here's a fix.

Zachary Lund 12 years ago
parent
commit
fe1adfceec
3 changed files with 42 additions and 3 deletions
  1. 14 1
      libobs-opengl/GL/gl_obs.c
  2. 14 1
      libobs-opengl/GL/glx_obs.c
  3. 14 1
      libobs-opengl/GL/wgl_obs.c

+ 14 - 1
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 */

+ 14 - 1
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 */

+ 14 - 1
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 */