summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-02-27 18:33:16 +0100
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-03-23 14:50:11 -0700
commit234384ece9c70f2a803ed2b1d1eb55b248ec43d1 (patch)
treea69fa3e64179667d79546f4f3d1b33f041e4ea22 /platform/macos
parent8e5214144ec4f3a4fb40b7a7e4d8f09fd10dbb78 (diff)
downloadqtlocation-mapboxgl-234384ece9c70f2a803ed2b1d1eb55b248ec43d1.tar.gz
[core] Move OpenGL extension initialization to Backend
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/src/MGLMapView.mm27
1 files changed, 13 insertions, 14 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index ef1c0f3bc1..45ac7c5357 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -26,7 +26,6 @@
#import <mbgl/map/camera.hpp>
#import <mbgl/storage/reachability.h>
#import <mbgl/util/default_thread_pool.hpp>
-#import <mbgl/gl/extension.hpp>
#import <mbgl/gl/context.hpp>
#import <mbgl/map/backend.hpp>
#import <mbgl/map/backend_scope.hpp>
@@ -768,19 +767,6 @@ public:
- (void)renderSync {
if (!self.dormant) {
- // Enable vertex buffer objects.
- mbgl::gl::InitializeExtensions([](const char *name) {
- static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
- if (!framework) {
- throw std::runtime_error("Failed to load OpenGL framework.");
- }
-
- CFStringRef str = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingASCII);
- void *symbol = CFBundleGetFunctionPointerForName(framework, str);
- CFRelease(str);
-
- return reinterpret_cast<mbgl::gl::glProc>(symbol);
- });
// The OpenGL implementation automatically enables the OpenGL context for us.
mbgl::BackendScope scope { *_mbglView, mbgl::BackendScope::ScopeType::Implicit };
@@ -2846,6 +2832,19 @@ public:
[nativeView sourceDidChange];
}
+ mbgl::gl::ProcAddress initializeExtension(const char* name) override {
+ static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
+ if (!framework) {
+ throw std::runtime_error("Failed to load OpenGL framework.");
+ }
+
+ CFStringRef str = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingASCII);
+ void *symbol = CFBundleGetFunctionPointerForName(framework, str);
+ CFRelease(str);
+
+ return reinterpret_cast<mbgl::gl::ProcAddress>(symbol);
+ }
+
void invalidate() override {
[nativeView setNeedsGLDisplay];
}