Fixed retrieval of OpenGL 1.0 and 1.1 on WGL.

This commit is contained in:
Camilla Berglund 2013-06-26 13:57:09 +02:00
parent 4883073b91
commit 194e22dbbe
3 changed files with 24 additions and 3 deletions

View File

@ -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 `-Wall` flag was not used with Clang and other GCC compatibles
- Bugfix: The default for `GLFW_ALPHA_BITS` was set to zero - Bugfix: The default for `GLFW_ALPHA_BITS` was set to zero
- [Win32] Bugfix: The clipboard string was not freed on terminate - [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 - [Cocoa] Bugfix: The clipboard string was not freed on terminate
- [X11] Bugfix: Override-redirect windows were resized to the desired instead - [X11] Bugfix: Override-redirect windows were resized to the desired instead
of the actual resolution of the selected video mode of the actual resolution of the selected video mode

View File

@ -297,6 +297,13 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
// //
int _glfwInitContextAPI(void) 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(); _glfw.wgl.current = TlsAlloc();
if (_glfw.wgl.current == TLS_OUT_OF_INDEXES) if (_glfw.wgl.current == TLS_OUT_OF_INDEXES)
{ {
@ -316,6 +323,9 @@ void _glfwTerminateContextAPI(void)
{ {
if (_glfw.wgl.hasTLS) if (_glfw.wgl.hasTLS)
TlsFree(_glfw.wgl.current); TlsFree(_glfw.wgl.current);
if (_glfw.wgl.opengl32.instance)
FreeLibrary(_glfw.wgl.opengl32.instance);
} }
#define setWGLattrib(attribName, attribValue) \ #define setWGLattrib(attribName, attribValue) \
@ -632,7 +642,11 @@ int _glfwPlatformExtensionSupported(const char* extension)
GLFWglproc _glfwPlatformGetProcAddress(const char* procname) 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);
} }

View File

@ -77,8 +77,13 @@ typedef struct _GLFWcontextWGL
//------------------------------------------------------------------------ //------------------------------------------------------------------------
typedef struct _GLFWlibraryWGL typedef struct _GLFWlibraryWGL
{ {
GLboolean hasTLS; GLboolean hasTLS;
DWORD current; DWORD current;
// opengl32.dll
struct {
HINSTANCE instance;
} opengl32;
} _GLFWlibraryWGL; } _GLFWlibraryWGL;