]> git.sesse.net Git - vlc/commitdiff
opengl: Fix the vout for Mac OS X.
authorPierre d'Herbemont <pdherbemont@free.fr>
Thu, 17 Dec 2009 01:42:49 +0000 (02:42 +0100)
committerPierre d'Herbemont <pdherbemont@free.fr>
Thu, 17 Dec 2009 01:44:25 +0000 (02:44 +0100)
Feel free to revert.

modules/video_output/opengl.c

index 93b8b1fc00cec21f6bff49486b6119704758681e..90e4416fab9417c0e51e5bf17c5043a8c002c1c5 100644 (file)
@@ -374,17 +374,40 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
 {
     vout_sys_t *p_sys = p_vout->p_sys;
 
+    picture_t *p_next = p_sys->p_current;
+
+    if( VLCGL_TEXTURE_COUNT > 1 )
+    {
+        /* Get the next picture to display */
+        p_next = picture_pool_Get( p_sys->p_pool );
+        assert( p_next );
+    }
+  
     if( p_sys->p_current )
     {
         assert( p_sys->p_current->p[0].p_pixels == p_pic->p[0].p_pixels );
 
+        /* Make sure we have the prepare after the picture_pool_Get,
+         * because picture_pool_Get() will bind the new picture texture,
+         * and vout_display_opengl_Prepare() bind the current rendered picture
+         * texture.
+         * DisplayVideo() will effectively use the last binded texture. */
+
         vout_display_opengl_Prepare( &p_sys->vgl, p_sys->p_current );
-        picture_Release( p_sys->p_current );
     }
 
-    p_sys->p_current = picture_pool_Get( p_sys->p_pool );
-    if( p_sys->p_current )
+    if( p_sys->p_current != p_next ) {
+        if( p_sys->p_current )
+            picture_Release( p_sys->p_current );
+        
+        /* Swap the picture texture on opengl vout side. */
+        p_sys->p_current = p_next;
+
+        /* Now, switch the only picture that is being used
+         * to render in the backend to point to our "next"
+         * picture texture */
         p_pic->p[0].p_pixels = p_sys->p_current->p[0].p_pixels;
+    }
 
     VLC_UNUSED( p_pic );
 }