diff --git a/README.md b/README.md index f31850ad..7ad77274 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,8 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/). - Bugfix: The `-Wall` flag was not used with Clang and other GCC compatibles - Bugfix: The default for `GLFW_ALPHA_BITS` was set to zero - [Win32] Bugfix: The clipboard string was not freed on terminate + - [Win32] Bugfix: Entry points for OpenGL 1.0 and 1.1 functions were not + returned by `glfwGetProcAddress` - [Cocoa] Bugfix: The clipboard string was not freed on terminate - [X11] Bugfix: Override-redirect windows were resized to the desired instead of the actual resolution of the selected video mode diff --git a/src/wgl_context.c b/src/wgl_context.c index 61d9a22e..943ff88e 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -297,6 +297,13 @@ static GLboolean choosePixelFormat(_GLFWwindow* window, // int _glfwInitContextAPI(void) { + _glfw.wgl.opengl32.instance = LoadLibrary(L"opengl32.dll"); + if (!_glfw.wgl.opengl32.instance) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to load opengl32.dll"); + return GL_FALSE; + } + _glfw.wgl.current = TlsAlloc(); if (_glfw.wgl.current == TLS_OUT_OF_INDEXES) { @@ -316,6 +323,9 @@ void _glfwTerminateContextAPI(void) { if (_glfw.wgl.hasTLS) TlsFree(_glfw.wgl.current); + + if (_glfw.wgl.opengl32.instance) + FreeLibrary(_glfw.wgl.opengl32.instance); } #define setWGLattrib(attribName, attribValue) \ @@ -632,7 +642,11 @@ int _glfwPlatformExtensionSupported(const char* extension) GLFWglproc _glfwPlatformGetProcAddress(const char* procname) { - return (GLFWglproc) wglGetProcAddress(procname); + const GLFWglproc proc = (GLFWglproc) wglGetProcAddress(procname); + if (proc) + return proc; + + return (GLFWglproc) GetProcAddress(_glfw.wgl.opengl32.instance, procname); } diff --git a/src/wgl_platform.h b/src/wgl_platform.h index 1472b98a..be000f88 100644 --- a/src/wgl_platform.h +++ b/src/wgl_platform.h @@ -77,8 +77,13 @@ typedef struct _GLFWcontextWGL //------------------------------------------------------------------------ typedef struct _GLFWlibraryWGL { - GLboolean hasTLS; - DWORD current; + GLboolean hasTLS; + DWORD current; + + // opengl32.dll + struct { + HINSTANCE instance; + } opengl32; } _GLFWlibraryWGL;