From 234384ece9c70f2a803ed2b1d1eb55b248ec43d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 27 Feb 2017 18:33:16 +0100 Subject: [core] Move OpenGL extension initialization to Backend --- platform/ios/src/MGLMapView.mm | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'platform/ios') diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 6bd3092445..e8bc1b4b2a 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1,7 +1,6 @@ #import "MGLMapView_Private.h" #include -#include #include #import @@ -610,21 +609,6 @@ public: [_glView bindDrawable]; [self insertSubview:_glView atIndex:0]; _glView.contentMode = UIViewContentModeCenter; - - // load extensions - // - mbgl::gl::InitializeExtensions([](const char * name) { - static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengles")); - 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(symbol); - }); } - (UIImage *)compassImage @@ -5436,6 +5420,20 @@ public: [nativeView didFinishLoadingStyle]; } + mbgl::gl::ProcAddress initializeExtension(const char* name) override { + static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengles")); + 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(symbol); + } + void invalidate() override { [nativeView setNeedsGLDisplay]; -- cgit v1.2.1