changeset 35094:967b0f13715c

Provide a swap buffer function for OS X. It does not change any of the issues with double buffering.
author reimar
date Thu, 13 Sep 2012 21:46:59 +0000
parents 627492239a72
children dfa2e1b78664
files libvo/gl_common.c libvo/osx_common.h libvo/osx_objc_common.h libvo/osx_objc_common.m
diffstat 4 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Thu Sep 13 21:45:14 2012 +0000
+++ b/libvo/gl_common.c	Thu Sep 13 21:46:59 2012 +0000
@@ -2359,7 +2359,7 @@
 #endif
 #ifdef CONFIG_GL_OSX
   case GLTYPE_OSX:
-//    ctx->swapGlBuffers = swapGlBuffers_osx;
+    ctx->swapGlBuffers = vo_osx_swap_buffers;
     ctx->update_xinerama_info = vo_osx_update_xinerama_info;
     ctx->check_events = vo_osx_check_events;
     ctx->fullscreen = vo_osx_fullscreen;
--- a/libvo/osx_common.h	Thu Sep 13 21:45:14 2012 +0000
+++ b/libvo/osx_common.h	Thu Sep 13 21:46:59 2012 +0000
@@ -32,5 +32,6 @@
 void vo_osx_fullscreen(void);
 int vo_osx_check_events(void);
 void vo_osx_update_xinerama_info(void);
+void vo_osx_swap_buffers(void);
 
 #endif /* MPLAYER_OSX_COMMON_H */
--- a/libvo/osx_objc_common.h	Thu Sep 13 21:45:14 2012 +0000
+++ b/libvo/osx_objc_common.h	Thu Sep 13 21:46:59 2012 +0000
@@ -53,6 +53,7 @@
 	int event_flags;
 @public
 	float winSizeMult;
+	NSOpenGLContext *glContext;
 }
 
 - (BOOL) acceptsFirstResponder;
--- a/libvo/osx_objc_common.m	Thu Sep 13 21:45:14 2012 +0000
+++ b/libvo/osx_objc_common.m	Thu Sep 13 21:46:59 2012 +0000
@@ -98,6 +98,11 @@
     [oglv update_screen_info];
 }
 
+void vo_osx_swap_buffers(void)
+{
+    [oglv->glContext flushBuffer];
+}
+
 @implementation MPCommonOpenGLView
 - (void) update_screen_info
 {
@@ -126,7 +131,6 @@
 
 - (void) preinit
 {
-	NSOpenGLContext *glContext;
 	GLint swapInterval = 1;
 
 	NSApplicationLoad();
@@ -169,11 +173,11 @@
 	[glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
 	[glContext setView:self];
 	[glContext makeCurrentContext];
-	[glContext release];
 }
 
 - (void) dealloc
 {
+	[glContext release];
 	[self setOpenGLContext:nil];
 	[super dealloc];
 }