From 537db9acb36b84a2ffc6dd68c3c4c6a2f7f350f3 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 15 Jan 2018 09:07:20 -0800 Subject: [PATCH] Fixing OSX build --- libraries/gl/src/gl/Config.cpp | 14 +++++++++++++- libraries/gl/src/gl/Config.h | 11 +++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/libraries/gl/src/gl/Config.cpp b/libraries/gl/src/gl/Config.cpp index b291674572..0e3a174e91 100644 --- a/libraries/gl/src/gl/Config.cpp +++ b/libraries/gl/src/gl/Config.cpp @@ -16,7 +16,10 @@ #if defined(Q_OS_WIN) #elif defined(Q_OS_ANDROID) #elif defined(Q_OS_MAC) +#include +#include #include +#include #else #include #include @@ -60,10 +63,19 @@ static void* getGlProcessAddress(const char *namez) { } #elif defined(Q_OS_MAC) + +static void* getGlProcessAddress(const char *namez) { + static void* GL_LIB = nullptr; + if (nullptr == GL_LIB) { + GL_LIB = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_NOW | RTLD_GLOBAL); + } + return dlsym(GL_LIB, namez); +} + #else static void* getGlProcessAddress(const char *namez) { - return (void*)glXGetProcAddressARB((const GLubyte*)namez); + return (void*)glXGetProcAddressARB((const GLubyte*)namez); } #endif diff --git a/libraries/gl/src/gl/Config.h b/libraries/gl/src/gl/Config.h index 0d296ea7e5..aad000a242 100644 --- a/libraries/gl/src/gl/Config.h +++ b/libraries/gl/src/gl/Config.h @@ -30,18 +30,21 @@ #define MINIMUM_GL_VERSION ((GL_MIN_VERSION_MAJOR << 8) | GL_MIN_VERSION_MINOR) +#include + #if defined(Q_OS_ANDROID) #include -#include #else -#include + #ifndef GL_SLUMINANCE8_EXT #define GL_SLUMINANCE8_EXT 0x8C47 #endif + // Prevent inclusion of System GL headers -#ifndef __gl_h_ +#define __glext_h_ #define __gl_h_ -#endif +#define __gl3_h_ + #endif // Platform specific code to load the GL functions