summaryrefslogtreecommitdiff
path: root/platform/macos/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-02-09 12:08:23 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-02-14 14:15:36 +0100
commit43e81509fb0be54bea5912fb5a10bfa0e0667a44 (patch)
tree3525de5e86d8c454b285468f07fd76f8ca4e99ee /platform/macos/src
parentd12ac71ba76c441e8dca97d0186abe4646a7d716 (diff)
downloadqtlocation-mapboxgl-43e81509fb0be54bea5912fb5a10bfa0e0667a44.tar.gz
[macos] reuse OpenGL context when switching screens
Diffstat (limited to 'platform/macos/src')
-rw-r--r--platform/macos/src/MGLOpenGLLayer.mm11
1 files changed, 10 insertions, 1 deletions
diff --git a/platform/macos/src/MGLOpenGLLayer.mm b/platform/macos/src/MGLOpenGLLayer.mm
index 17ba9951c7..fde2b52404 100644
--- a/platform/macos/src/MGLOpenGLLayer.mm
+++ b/platform/macos/src/MGLOpenGLLayer.mm
@@ -2,7 +2,9 @@
#import "MGLMapView_Private.h"
-@implementation MGLOpenGLLayer
+@implementation MGLOpenGLLayer {
+ NSOpenGLContext *_context;
+}
- (MGLMapView *)mapView {
return (MGLMapView *)super.view;
@@ -20,6 +22,13 @@
return self.view.bounds;
}
+- (NSOpenGLContext *)openGLContextForPixelFormat:(NSOpenGLPixelFormat *)pixelFormat {
+ if (!_context) {
+ _context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
+ }
+ return _context;
+}
+
- (NSOpenGLPixelFormat *)openGLPixelFormatForDisplayMask:(uint32_t)mask {
NSOpenGLPixelFormatAttribute pfas[] = {
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy,