From 29f8dfd37a2fbf4190e551bef0b04ff1ae1fd7b6 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 29 Jul 2013 22:31:32 +0000 Subject: BGE: Adding vsync control. Users can enable vsync, disable vsync, or use adaptive vsync via UI options in the render properties, or by using the new Python method bge.render.setVsync(). Win32 and X11 support are done via EXT_swap_control. Support for using EXT_swap_control on OS X still needs to be added to Ghost. --- intern/ghost/intern/GHOST_WindowWin32.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'intern/ghost/intern/GHOST_WindowWin32.cpp') diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index b0d0b1a5b5d..c264686fbb1 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -648,6 +648,20 @@ GHOST_TSuccess GHOST_WindowWin32::swapBuffers() return ::SwapBuffers(hDC) == TRUE ? GHOST_kSuccess : GHOST_kFailure; } +GHOST_TSuccess GHOST_WindowWin32::setSwapInterval(int interval) +{ + if (!WGL_EXT_swap_control) + return GHOST_kFailure; + return wglSwapIntervalEXT(interval) == TRUE ? GHOST_kSuccess : GHOST_kFailure; +} + +int GHOST_WindowWin32::getSwapInterval() +{ + if (WGL_EXT_swap_control) + return wglGetSwapIntervalEXT(); + + return 0; +} GHOST_TSuccess GHOST_WindowWin32::activateDrawingContext() { -- cgit v1.2.3