Simplify and speed up code resolving gl functions

Change-Id: I36d8881b658760dde18e4f52742c49f3c0cab7a5
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Lars Knoll 2016-02-02 09:50:19 +01:00 committed by Laszlo Agocs
parent 69f29b9032
commit 696dc4f6df
3 changed files with 3 additions and 15 deletions

View File

@ -42,19 +42,7 @@
#include <QtCore/private/qcore_mac_p.h>
#include <AppKit/AppKit.h>
#include <QVector>
QFunctionPointer qcgl_getProcAddress(const char *procName)
{
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
CFSTR("/System/Library/Frameworks/OpenGL.framework"), kCFURLPOSIXPathStyle, false);
CFBundleRef bundle = CFBundleCreate(kCFAllocatorDefault, url);
CFStringRef procNameCF = QCFString::toCFStringRef(QString::fromLatin1(procName));
void *proc = CFBundleGetFunctionPointerForName(bundle, procNameCF);
CFRelease(url);
CFRelease(bundle);
CFRelease(procNameCF);
return (QFunctionPointer)proc;
}
#include <qdebug.h>
// Match up with createNSOpenGLPixelFormat below!
QSurfaceFormat qcgl_surfaceFormat()

View File

@ -55,7 +55,6 @@
#include <QString>
#include <OpenGL/OpenGL.h>
QFunctionPointer qcgl_getProcAddress(const char *procName);
QSurfaceFormat qcgl_surfaceFormat();
void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format);

View File

@ -44,6 +44,7 @@
#include <QtCore/private/qcore_mac_p.h>
#include <QtPlatformSupport/private/cglconvenience_p.h>
#include <QtPlatformHeaders/qcocoanativecontext.h>
#include <dlfcn.h>
#import <AppKit/AppKit.h>
@ -337,7 +338,7 @@ void QCocoaGLContext::doneCurrent()
QFunctionPointer QCocoaGLContext::getProcAddress(const char *procName)
{
return qcgl_getProcAddress(procName);
return (QFunctionPointer)dlsym(RTLD_DEFAULT, procName);
}
void QCocoaGLContext::update()