Commit 9a6a3a03 authored by Eric Petit's avatar Eric Petit

macosx/vout.m: swap OpenGL buffers only during the vertical retrace of

   the monitor (fixed flickering effect)
parent e8350fda
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.m: MacOS X video output module * vout.m: MacOS X video output module
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.72 2004/01/27 12:11:48 titer Exp $ * $Id: vout.m,v 1.73 2004/01/28 14:36:53 titer Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <QuickTime/QuickTime.h> #include <QuickTime/QuickTime.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#include <OpenGL/glext.h> #include <OpenGL/glext.h>
...@@ -1271,12 +1272,19 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1271,12 +1272,19 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
NSOpenGLPFAAccelerated, NSOpenGLPFAAccelerated,
NSOpenGLPFANoRecovery, NSOpenGLPFANoRecovery,
NSOpenGLPFADoubleBuffer, NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
0 0
}; };
NSOpenGLPixelFormat * fmt = [[NSOpenGLPixelFormat alloc] NSOpenGLPixelFormat * fmt = [[NSOpenGLPixelFormat alloc]
initWithAttributes: attribs]; initWithAttributes: attribs];
if( !fmt )
{
fprintf( stderr, "Cannot create NSOpenGLPixelFormat\n" );
return self;
}
self = [super initWithFrame:frame pixelFormat: fmt]; self = [super initWithFrame:frame pixelFormat: fmt];
[[self openGLContext] makeCurrentContext]; [[self openGLContext] makeCurrentContext];
...@@ -1296,7 +1304,8 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1296,7 +1304,8 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
[[self openGLContext] update]; [[self openGLContext] update];
NSRect bounds = [self bounds]; NSRect bounds = [self bounds];
glViewport( 0, 0, (GLint) bounds.size.width, (GLint) bounds.size.height ); glViewport( 0, 0, (GLint) bounds.size.width,
(GLint) bounds.size.height );
} }
- (void)drawRect:(NSRect)rect - (void)drawRect:(NSRect)rect
...@@ -1305,10 +1314,15 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1305,10 +1314,15 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
id o_window = [self window]; id o_window = [self window];
p_vout = (vout_thread_t *)[o_window getVout]; p_vout = (vout_thread_t *)[o_window getVout];
/* Make this current context */ /* Make this current context */
[[self openGLContext] makeCurrentContext]; [[self openGLContext] makeCurrentContext];
/* http://developer.apple.com/documentation/GraphicsImaging/
Conceptual/OpenGL/chap5/chapter_5_section_44.html */
long params[] = { 1 };
CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval,
params );
/* Black background */ /* Black background */
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment