aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pugl/pugl.h11
-rw-r--r--pugl/pugl_osx.m16
-rw-r--r--pugl/pugl_win.cpp6
-rw-r--r--pugl/pugl_x11_gl.c6
4 files changed, 39 insertions, 0 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h
index b2937e2..9e70100 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -630,6 +630,17 @@ puglProcessEvents(PuglView* view);
*/
/**
+ OpenGL extension function.
+*/
+typedef void (*PuglGlFunc)();
+
+/**
+ Return the address of an OpenGL extension function.
+*/
+PUGL_API PuglGlFunc
+puglGetProcAddress(const char* name);
+
+/**
Request a redisplay on the next call to puglProcessEvents().
*/
PUGL_API void
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m
index 8e40907..e56a1a7 100644
--- a/pugl/pugl_osx.m
+++ b/pugl/pugl_osx.m
@@ -702,6 +702,22 @@ puglProcessEvents(PuglView* view)
return PUGL_SUCCESS;
}
+PuglGlFunc
+puglGetProcAddress(const char *name)
+{
+ CFBundleRef framework =
+ CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
+
+ CFStringRef symbol = CFStringCreateWithCString(
+ kCFAllocatorDefault, name, kCFStringEncodingASCII);
+
+ PuglGlFunc func = CFBundleGetFunctionPointerForName(framework, symbol);
+
+ CFRelease(symbol);
+
+ return func;
+}
+
void
puglPostRedisplay(PuglView* view)
{
diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp
index 2c092eb..048c0c3 100644
--- a/pugl/pugl_win.cpp
+++ b/pugl/pugl_win.cpp
@@ -631,6 +631,12 @@ wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
}
+PuglGlFunc
+puglGetProcAddress(const char* name)
+{
+ return (PuglGlFunc)wglGetProcAddress(name);
+}
+
void
puglPostRedisplay(PuglView* view)
{
diff --git a/pugl/pugl_x11_gl.c b/pugl/pugl_x11_gl.c
index 6c007b1..f9e3ce2 100644
--- a/pugl/pugl_x11_gl.c
+++ b/pugl/pugl_x11_gl.c
@@ -186,6 +186,12 @@ puglX11GlGetHandle(PuglView* view)
return NULL;
}
+PuglGlFunc
+puglGetProcAddress(const char* name)
+{
+ return glXGetProcAddress((const GLubyte*)name);
+}
+
PuglDrawContext puglGetX11GlDrawContext(void)
{
static const PuglDrawContext puglX11GlDrawContext = {