From 5fac75bd9aadeb3216a591fe694806e9f4e116b7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 8 Aug 2019 22:02:24 +0200 Subject: Windows: Fix puglGetProcAddress() for OpenGL 1.1 functions --- pugl/detail/win_gl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pugl/detail/win_gl.c b/pugl/detail/win_gl.c index eb7771c..b7b03a4 100644 --- a/pugl/detail/win_gl.c +++ b/pugl/detail/win_gl.c @@ -286,7 +286,15 @@ puglWinGlGetContext(PuglView* PUGL_UNUSED(view)) PuglGlFunc puglGetProcAddress(const char* name) { - return (PuglGlFunc)wglGetProcAddress(name); + const PuglGlFunc func = (PuglGlFunc)wglGetProcAddress(name); + + /* Windows has the annoying property that wglGetProcAddress returns NULL + for functions from OpenGL 1.1, so we fall back to pulling them directly + from opengl32.dll */ + + return func + ? func + : (PuglGlFunc)GetProcAddress(GetModuleHandle("opengl32.dll"), name); } const PuglBackend* -- cgit v1.2.1