Commit 3c0d600e authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Lets go beserk on the locking and event passing for OpenGL resize. Haven't...

* Lets go beserk on the locking and event passing for OpenGL resize. Haven't been able to crash it anymore.
  closes #45
parent 1e2dc4cd
......@@ -279,6 +279,8 @@ static void Unlock( vout_thread_t * p_vout )
{
int x, y;
vlc_value_t val;
Lock( p_vout );
NSRect bounds = [self bounds];
[[self openGLContext] makeCurrentContext];
......@@ -301,16 +303,15 @@ static void Unlock( vout_thread_t * p_vout )
y = bounds.size.width * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
}
Lock( p_vout );
glViewport( ( bounds.size.width - x ) / 2,
( bounds.size.height - y ) / 2, x, y );
Unlock( p_vout );
if( p_vout->p_sys->b_got_frame )
{
/* Ask the opengl module to redraw */
vout_thread_t * p_parent;
p_parent = (vout_thread_t *) p_vout->p_parent;
Unlock( p_vout );
if( p_parent && p_parent->pf_display )
{
p_parent->pf_display( p_parent, NULL );
......@@ -318,17 +319,25 @@ static void Unlock( vout_thread_t * p_vout )
}
else
{
Lock( p_vout );
glClear( GL_COLOR_BUFFER_BIT );
Unlock( p_vout );
}
[super reshape];
}
- (void) update
{
Lock( p_vout );
[super update];
Unlock( p_vout );
}
- (void) drawRect: (NSRect) rect
{
[[self openGLContext] makeCurrentContext];
Lock( p_vout );
[[self openGLContext] makeCurrentContext];
glFlush();
[super drawRect:rect];
Unlock( p_vout );
}
......
......@@ -562,6 +562,13 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
vout_sys_t *p_sys = p_vout->p_sys;
float f_width, f_height;
if( p_sys->p_vout->pf_lock &&
p_sys->p_vout->pf_lock( p_sys->p_vout ) )
{
msg_Warn( p_vout, "could not lock OpenGL provider" );
return;
}
/* glTexCoord works differently with GL_TEXTURE_2D and
GL_TEXTURE_RECTANGLE_EXT */
#ifdef SYS_DARWIN
......@@ -576,13 +583,6 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
OpenGL providers can call pf_display to force redraw. Currently,
the OS X provider uses it to get a smooth window resizing */
if( p_sys->p_vout->pf_lock &&
p_sys->p_vout->pf_lock( p_sys->p_vout ) )
{
msg_Warn( p_vout, "could not lock OpenGL provider" );
return;
}
glClear( GL_COLOR_BUFFER_BIT );
if( p_sys->i_effect == OPENGL_EFFECT_NONE )
......
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