[vlc-commits] Used WGL_EXT_swap_control in glwin32.

Laurent Aimar git at videolan.org
Sun Jun 5 16:26:06 CEST 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Jun  2 21:56:23 2011 +0200| [81072d68c7f84a78a35370af892deed1fe23ce0c] | committer: Laurent Aimar

Used WGL_EXT_swap_control in glwin32.

It avoid tearing depending on the default settings.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=81072d68c7f84a78a35370af892deed1fe23ce0c
---

 modules/video_output/msw/glwin32.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/modules/video_output/msw/glwin32.c b/modules/video_output/msw/glwin32.c
index fb7ec30..7199094 100644
--- a/modules/video_output/msw/glwin32.c
+++ b/modules/video_output/msw/glwin32.c
@@ -39,6 +39,7 @@
 #endif
 
 #include "../opengl.h"
+#include <GL/wglew.h>
 #include "common.h"
 
 /*****************************************************************************
@@ -108,6 +109,15 @@ static int Open(vlc_object_t *object)
     sys->hGLRC = wglCreateContext(sys->hGLDC);
     wglMakeCurrent(sys->hGLDC, sys->hGLRC);
 
+    const char *extensions = (const char*)glGetString(GL_EXTENSIONS);
+#ifdef WGL_EXT_swap_control
+    if (HasExtension(extensions, "WGL_EXT_swap_control")) {
+        PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
+        if (SwapIntervalEXT)
+            SwapIntervalEXT(1);
+    }
+#endif
+
     /* */
     sys->gl.lock = NULL;
     sys->gl.unlock = NULL;



More information about the vlc-commits mailing list