aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-08-08 22:02:24 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:34:56 +0200
commit5fac75bd9aadeb3216a591fe694806e9f4e116b7 (patch)
tree5da70e4d92f94c333b1c99ed381e73b2c828146e
parent67a5799618186beecd0ea028101395de3569345f (diff)
downloadpugl-5fac75bd9aadeb3216a591fe694806e9f4e116b7.tar.gz
pugl-5fac75bd9aadeb3216a591fe694806e9f4e116b7.tar.bz2
pugl-5fac75bd9aadeb3216a591fe694806e9f4e116b7.zip
Windows: Fix puglGetProcAddress() for OpenGL 1.1 functions
-rw-r--r--pugl/detail/win_gl.c10
1 files changed, 9 insertions, 1 deletions
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*