Changeset 117ebd7e7f293625f016d4da8d04484e6c447a19

Show
Ignore:
Timestamp:
04/01/08 01:07:34 (1 year ago)
Author:
Faustino Osuna <riquedafreak@videolan.org>
git-committer:
Faustino Osuna <riquedafreak@videolan.org> 1199405254 +0000
git-parent:

[3772bb954172d7e530873f4809ef660085344cd3]

git-author:
Faustino Osuna <riquedafreak@videolan.org> 1199405254 +0000
Message:

video_output/opengllayer.m: Revert backbuffer resizing & code cleanup.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/video_output/opengllayer.m

    r978372f r117ebd7  
    239239    vout_sys_t *p_sys = p_vout->p_sys; 
    240240 
    241     p_vout->p_sys->b_frame_available = 0
     241    p_vout->p_sys->b_frame_available = VLC_FALSE
    242242 
    243243    [CATransaction performSelectorOnMainThread:@selector(begin) 
     
    254254 
    255255    /* Free the texture buffer*/ 
    256     if( p_sys->pp_buffer[0] ) free( p_sys->pp_buffer[0] ); 
    257     if( p_sys->pp_buffer[1] ) free( p_sys->pp_buffer[1] ); 
     256    free( p_sys->pp_buffer[0] ); 
     257    free( p_sys->pp_buffer[1] ); 
    258258} 
    259259 
     
    297297    /* Give a buffer where the image will be rendered */ 
    298298    p_pic->p->p_pixels = p_sys->pp_buffer[p_new_index]; 
    299  
    300299} 
    301300 
     
    313312    } 
    314313 
    315     p_sys->b_frame_available = 1
     314    p_sys->b_frame_available = VLC_TRUE
    316315} 
    317316 
     
    395394{ 
    396395    vout_thread_t * p_vout = [arg pointerValue]; 
    397     p_vout->p_sys->o_layer = [[VLCVoutLayer layerWithVout: p_vout] retain]; 
     396    p_vout->p_sys->o_layer = [[VLCVoutLayer layerWithVout:p_vout] retain]; 
    398397    [p_vout->p_sys->o_cocoa_container addVoutLayer:p_vout->p_sys->o_layer]; 
    399398} 
     
    420419- (BOOL)canDrawInCGLContext:(CGLContextObj)glContext pixelFormat:(CGLPixelFormatObj)pixelFormat forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp 
    421420{ 
    422     /* Only draw the frame when if have a frame that was previously rendered */ 
    423     BOOL ret = p_vout->p_sys->b_frame_available; 
    424     p_vout->p_sys->b_frame_available = VLC_FALSE; 
    425     return ret; 
     421    /* Only draw the frame if we have a frame that was previously rendered */ 
     422    return p_vout->p_sys->b_frame_available;    // Flag is cleared by drawInCGLContext:pixelFormat:forLayerTime:displayTime: 
    426423} 
    427424 
     
    449446                     p_vout->fmt_out.i_height, 
    450447                     VLCGL_FORMAT, VLCGL_TYPE, p_vout->p_sys->pp_buffer[p_vout->p_sys->i_index] ); 
    451  
    452448 
    453449        glClear( GL_COLOR_BUFFER_BIT ); 
     
    467463 
    468464    CGLUnlockContext( glContext ); 
    469     p_vout->p_sys->b_frame_available = VLC_FALSE; 
    470 
    471  
    472 - (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask 
    473 
    474     GLuint attribs[] =  
    475     { 
    476         NSOpenGLPFANoRecovery, 
    477         NSOpenGLPFAWindow, 
    478         NSOpenGLPFAAccelerated, 
    479         NSOpenGLPFADoubleBuffer, 
    480         NSOpenGLPFAColorSize, 24, 
    481         NSOpenGLPFAAlphaSize, 8, 
    482         NSOpenGLPFADepthSize, 24, 
    483         NSOpenGLPFAStencilSize, 8, 
    484         NSOpenGLPFAAccumSize, 0, 
    485         0 
    486     }; 
    487  
    488     NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*) attribs];  
     465 
     466    p_vout->p_sys->b_frame_available = VLC_FALSE;  
     467
     468 
     469// - (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask 
     470// { 
     471//  GLuint attribs[] =  
     472//  { 
     473//      NSOpenGLPFANoRecovery, 
     474//      NSOpenGLPFAWindow, 
     475//      NSOpenGLPFAAccelerated, 
     476//      NSOpenGLPFADoubleBuffer, 
     477//      NSOpenGLPFAColorSize, 24, 
     478//      NSOpenGLPFAAlphaSize, 8, 
     479//      NSOpenGLPFADepthSize, 24, 
     480//      NSOpenGLPFAStencilSize, 8, 
     481//      NSOpenGLPFAAccumSize, 0, 
     482//      0 
     483//  }; 
     484//  
     485//  NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*) attribs];  
     486//      
     487//     return [fmt CGLPixelFormatObj]; 
     488// } 
     489 
     490- (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat 
     491
     492    CGLContextObj context = [super copyCGLContextForPixelFormat:pixelFormat]; 
     493 
     494    CGLLockContext( context );  
    489495     
    490     return [super copyCGLPixelFormatForDisplayMask:mask];//[fmt CGLPixelFormatObj]; 
    491 
    492  
    493 - (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat 
    494 
    495     CGLContextObj context = [super copyCGLContextForPixelFormat:pixelFormat]; 
    496  
     496    CGLSetCurrentContext( context ); 
    497497 
    498498    /* Swap buffers only during the vertical retrace of the monitor. 
     
    502502    GLint params = 1; 
    503503    CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval, 
    504                     &params ); 
     504                    &params ); 
    505505     
    506     /* Make sure our texture will gets drawn at the right resolution */ 
    507     GLint dim[2] = { p_vout->p_sys->i_tex_width, p_vout->p_sys->i_tex_height}; 
    508     NSLog(@"asking for %dx%d", p_vout->p_sys->i_tex_width, p_vout->p_sys->i_tex_height); 
    509     CGLSetParameter(context, kCGLCPSurfaceBackingSize, dim); 
    510     CGLEnable (context, kCGLCESurfaceBackingSize); 
    511  
    512     CGLSetCurrentContext( context ); 
    513506    InitTextures( p_vout ); 
    514507 
    515     glDisable(GL_BLEND); 
    516     glDisable(GL_DEPTH_TEST); 
    517     glDepthMask(GL_FALSE); 
    518     glDisable(GL_CULL_FACE)
     508    glDisable( GL_BLEND ); 
     509    glDisable( GL_DEPTH_TEST ); 
     510    glDepthMask( GL_FALSE ); 
     511    glDisable( GL_CULL_FACE)
    519512    glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); 
    520513    glClear( GL_COLOR_BUFFER_BIT ); 
    521514 
     515    CGLUnlockContext( context ); 
    522516    return context; 
    523517} 
     
    532526    CGLUnlockContext( glContext ); 
    533527} 
    534  
    535528@end