From b444cabe4d7fe3a3163b22c0eeeeb034922fc1d0 Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 19:32:38 +0100 Subject: [PATCH 1/6] vSync on opengl --- Engine/source/gfx/gl/gfxGLDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index 2e22530ed..cdc9ab003 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -147,7 +147,7 @@ void GFXGLDevice::initGLState() } #endif - PlatformGL::setVSync(0); + PlatformGL::setVSync(smDisableVSync ? 0 : 2); //OpenGL 3 need a binded VAO for render GLuint vao; From 005f322a94c4879729f0f33e3be887e7b41011ad Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 19:41:00 +0100 Subject: [PATCH 2/6] vsync update on reset settings --- Engine/source/gfx/gl/gfxGLWindowTarget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/gfx/gl/gfxGLWindowTarget.cpp b/Engine/source/gfx/gl/gfxGLWindowTarget.cpp index c02ff1bc3..b92f695a7 100644 --- a/Engine/source/gfx/gl/gfxGLWindowTarget.cpp +++ b/Engine/source/gfx/gl/gfxGLWindowTarget.cpp @@ -44,6 +44,8 @@ GFXGLWindowTarget::GFXGLWindowTarget(PlatformWindow *win, GFXDevice *d) void GFXGLWindowTarget::resetMode() { + PlatformGL::setVSync(GFXDevice::smDisableVSync ? 0 : 2); + if(mWindow->getVideoMode().fullScreen != mWindow->isFullscreen()) { _teardownCurrentMode(); From 2165266ff469525d9576e564dd052db31864eb27 Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 20:44:47 +0100 Subject: [PATCH 3/6] revert vsync on reset changes --- Engine/source/gfx/gl/gfxGLWindowTarget.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Engine/source/gfx/gl/gfxGLWindowTarget.cpp b/Engine/source/gfx/gl/gfxGLWindowTarget.cpp index b92f695a7..c02ff1bc3 100644 --- a/Engine/source/gfx/gl/gfxGLWindowTarget.cpp +++ b/Engine/source/gfx/gl/gfxGLWindowTarget.cpp @@ -44,8 +44,6 @@ GFXGLWindowTarget::GFXGLWindowTarget(PlatformWindow *win, GFXDevice *d) void GFXGLWindowTarget::resetMode() { - PlatformGL::setVSync(GFXDevice::smDisableVSync ? 0 : 2); - if(mWindow->getVideoMode().fullScreen != mWindow->isFullscreen()) { _teardownCurrentMode(); From 1a76341049af898a5017c092769129db1c5cb703 Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 20:46:27 +0100 Subject: [PATCH 4/6] Update gfxGLDevice.cpp --- Engine/source/gfx/gl/gfxGLDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index cdc9ab003..0132a4a9f 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -147,7 +147,7 @@ void GFXGLDevice::initGLState() } #endif - PlatformGL::setVSync(smDisableVSync ? 0 : 2); + PlatformGL::setVSync(smDisableVSync ? 0 : 1); //OpenGL 3 need a binded VAO for render GLuint vao; From 7455f123438b40d02ea38636d1ac1e76d25b7116 Mon Sep 17 00:00:00 2001 From: Anis Date: Sat, 6 Dec 2014 20:55:43 +0100 Subject: [PATCH 5/6] check extension before use it --- Engine/source/platformWin32/WinPlatformGL.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Engine/source/platformWin32/WinPlatformGL.cpp b/Engine/source/platformWin32/WinPlatformGL.cpp index 5413d37b7..a85245ef1 100644 --- a/Engine/source/platformWin32/WinPlatformGL.cpp +++ b/Engine/source/platformWin32/WinPlatformGL.cpp @@ -5,7 +5,10 @@ void PlatformGL::setVSync(const int i) { - wglSwapIntervalEXT( i ); + if (WGLEW_EXT_swap_control) + { + wglSwapIntervalEXT(i); + } } -#endif \ No newline at end of file +#endif From ee4f0df69a922bb4a98cf4cfe03c2b22345fc781 Mon Sep 17 00:00:00 2001 From: Anis Date: Mon, 19 Jan 2015 17:44:48 +0100 Subject: [PATCH 6/6] Update gfxGLDevice.win.cpp --- Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp index f2f81b8fa..6d4d09d0b 100644 --- a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp +++ b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp @@ -297,8 +297,6 @@ void GFXGLDevice::init( const GFXVideoMode &mode, PlatformWindow *window ) loadGLCore(); loadGLExtensions(hdcGL); - - wglSwapIntervalEXT(0); // It is very important that extensions be loaded // before we call initGLState()