Fixing OSX build

This commit is contained in:
Bradley Austin Davis 2018-01-15 09:07:20 -08:00
parent 58530c595a
commit 537db9acb3
2 changed files with 20 additions and 5 deletions

View file

@ -16,7 +16,10 @@
#if defined(Q_OS_WIN)
#elif defined(Q_OS_ANDROID)
#elif defined(Q_OS_MAC)
#include <OpenGL/OpenGL.h>
#include <OpenGL/CGLTypes.h>
#include <OpenGL/CGLCurrent.h>
#include <dlfcn.h>
#else
#include <GL/glx.h>
#include <dlfcn.h>
@ -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

View file

@ -30,18 +30,21 @@
#define MINIMUM_GL_VERSION ((GL_MIN_VERSION_MAJOR << 8) | GL_MIN_VERSION_MINOR)
#include <glad/glad.h>
#if defined(Q_OS_ANDROID)
#include <EGL/egl.h>
#include <glad/glad.h>
#else
#include <glad/glad.h>
#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