From b3b5e95bf4655bf78e0f2970bd427d44272a5fc2 Mon Sep 17 00:00:00 2001 From: kappaOne Date: Fri, 30 Nov 2012 23:24:12 +0000 Subject: [PATCH] Use a fixed back buffer for proper resolution in fullscreen mode --- src/native/macosx/org_lwjgl_opengl_Display.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/native/macosx/org_lwjgl_opengl_Display.m b/src/native/macosx/org_lwjgl_opengl_Display.m index 397c99b3..045b57ec 100644 --- a/src/native/macosx/org_lwjgl_opengl_Display.m +++ b/src/native/macosx/org_lwjgl_opengl_Display.m @@ -457,8 +457,18 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nCreateWindow(JNIE [window_info->window setContentView:window_info->view]; + // disable any fixed backbuffer size to allow resizing + CGLContextObj cgcontext = (CGLContextObj)[[window_info->view openGLContext] CGLContextObj]; + CGLDisable(cgcontext, kCGLCESurfaceBackingSize); } else { + // set a fixed backbuffer size for fullscreen + CGLContextObj cgcontext = (CGLContextObj)[[window_info->view openGLContext] CGLContextObj]; + GLint dim[2] = {width, height}; + CGLSetParameter(cgcontext, kCGLCPSurfaceBackingSize, dim); + CGLEnable(cgcontext, kCGLCESurfaceBackingSize); + + // enter fullscreen mode [window_info->view enterFullScreenMode: [NSScreen mainScreen] withOptions: nil ]; window_info->window = [window_info->view window];