summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-11-24 15:48:39 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-11-24 15:48:39 +0100
commitc3011e32e43bd4fa986e9b9a220c7d28bb958c2c (patch)
tree422ecbb15e176b2d584cb7a15f5d808663579492 /src
parentbe0f06e79116f8dae021be112963fdfac2fec74f (diff)
Improve text drawing above GL3 scene under macOS
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
index 626600e25..2420d12b0 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
@@ -255,10 +255,14 @@ void Fl_Cocoa_Gl_Window_Driver::after_show() {
NSView *view = [fl_mac_xid(pWindow) contentView];
NSView *gl1view = [[NSView alloc] initWithFrame:[view frame]];
[gl1view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
- NSOpenGLPixelFormat *gl1pixelformat = mode_to_NSOpenGLPixelFormat(
+ static NSOpenGLContext *shared_gl1_ctxt = nil;
+ static NSOpenGLPixelFormat *gl1pixelformat = mode_to_NSOpenGLPixelFormat(
FL_RGB8 | FL_ALPHA | FL_SINGLE, NULL);
- gl1ctxt = [[NSOpenGLContext alloc] initWithFormat:gl1pixelformat shareContext:nil];
- [gl1pixelformat release];
+ gl1ctxt = [[NSOpenGLContext alloc] initWithFormat:gl1pixelformat shareContext:shared_gl1_ctxt];
+ if (!shared_gl1_ctxt) {
+ shared_gl1_ctxt = gl1ctxt;
+ [shared_gl1_ctxt retain];
+ }
[view addSubview:gl1view];
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_7
if (fl_mac_os_version >= 100700 && Fl::use_high_res_GL()) {