Commit 978372f4 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

video_output/opengllayer.m: Revert previous commit, and attempt to get the resolution fix working.

parent 480898d1
...@@ -313,7 +313,6 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -313,7 +313,6 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
} }
p_sys->b_frame_available = 1; p_sys->b_frame_available = 1;
[p_sys->o_layer setNeedsDisplay];
} }
/***************************************************************************** /*****************************************************************************
...@@ -409,7 +408,7 @@ static int InitTextures( vout_thread_t *p_vout ) ...@@ -409,7 +408,7 @@ static int InitTextures( vout_thread_t *p_vout )
VLCVoutLayer* me = [super layer]; VLCVoutLayer* me = [super layer];
if( me ) if( me )
{ {
me.asynchronous = NO; me.asynchronous = YES;
[me setVout: _p_vout]; [me setVout: _p_vout];
me.bounds = CGRectMake( 0.0, 0.0, me.bounds = CGRectMake( 0.0, 0.0,
(float)_p_vout->fmt_in.i_visible_width * _p_vout->fmt_in.i_sar_num, (float)_p_vout->fmt_in.i_visible_width * _p_vout->fmt_in.i_sar_num,
...@@ -450,7 +449,6 @@ static int InitTextures( vout_thread_t *p_vout ) ...@@ -450,7 +449,6 @@ static int InitTextures( vout_thread_t *p_vout )
p_vout->fmt_out.i_height, p_vout->fmt_out.i_height,
VLCGL_FORMAT, VLCGL_TYPE, p_vout->p_sys->pp_buffer[p_vout->p_sys->i_index] ); VLCGL_FORMAT, VLCGL_TYPE, p_vout->p_sys->pp_buffer[p_vout->p_sys->i_index] );
}
glClear( GL_COLOR_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT );
...@@ -465,7 +463,10 @@ static int InitTextures( vout_thread_t *p_vout ) ...@@ -465,7 +463,10 @@ static int InitTextures( vout_thread_t *p_vout )
glDisable( VLCGL_TARGET ); glDisable( VLCGL_TARGET );
glFlush(); glFlush();
}
CGLUnlockContext( glContext ); CGLUnlockContext( glContext );
p_vout->p_sys->b_frame_available = VLC_FALSE;
} }
- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask - (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask
...@@ -486,15 +487,28 @@ static int InitTextures( vout_thread_t *p_vout ) ...@@ -486,15 +487,28 @@ static int InitTextures( vout_thread_t *p_vout )
NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*) attribs]; NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*) attribs];
return [super copyCGLPixelFormatForDisplayMask:mask];//[fmt CGLPixelFormatObj];
return [fmt CGLPixelFormatObj];
} }
- (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat - (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat
{ {
CGLContextObj context = [super copyCGLContextForPixelFormat:pixelFormat]; CGLContextObj context = [super copyCGLContextForPixelFormat:pixelFormat];
CGLLockContext( context );
/* Swap buffers only during the vertical retrace of the monitor.
http://developer.apple.com/documentation/GraphicsImaging/
Conceptual/OpenGL/chap5/chapter_5_section_44.html */
GLint params = 1;
CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval,
&params );
/* Make sure our texture will gets drawn at the right resolution */
GLint dim[2] = { p_vout->p_sys->i_tex_width, p_vout->p_sys->i_tex_height};
NSLog(@"asking for %dx%d", p_vout->p_sys->i_tex_width, p_vout->p_sys->i_tex_height);
CGLSetParameter(context, kCGLCPSurfaceBackingSize, dim);
CGLEnable (context, kCGLCESurfaceBackingSize);
CGLSetCurrentContext( context ); CGLSetCurrentContext( context );
InitTextures( p_vout ); InitTextures( p_vout );
...@@ -505,16 +519,6 @@ static int InitTextures( vout_thread_t *p_vout ) ...@@ -505,16 +519,6 @@ static int InitTextures( vout_thread_t *p_vout )
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
glClear( GL_COLOR_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT );
/* Swap buffers only during the vertical retrace of the monitor.
http://developer.apple.com/documentation/GraphicsImaging/
Conceptual/OpenGL/chap5/chapter_5_section_44.html */
GLint params = 1;
CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval,
&params );
CGLUnlockContext( context );
return context; return context;
} }
......
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