summaryrefslogtreecommitdiffstats
path: root/platform/windows/context_gl_win.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-05 19:14:33 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-05 19:14:33 -0300
commit2420e46b449f4c8acdfe48c765ea52fc3e860de7 (patch)
treea49df7158f20ee6dca044c8ff7d7e81c13d83073 /platform/windows/context_gl_win.cpp
parent684a1207c0a08889be7024d5851c224877557053 (diff)
downloadredot-engine-2420e46b449f4c8acdfe48c765ea52fc3e860de7.tar.gz
vsync support
-works on windows -may not work on X11, if so please fix -OSX does not seem to support disabling vsync
Diffstat (limited to 'platform/windows/context_gl_win.cpp')
-rw-r--r--platform/windows/context_gl_win.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index ab66b81421..fd9e895370 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -96,6 +96,20 @@ static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) {
}
*/
+void ContextGL_Win::set_use_vsync(bool p_use) {
+
+ if (wglSwapIntervalEXT) {
+ wglSwapIntervalEXT(p_use?1:0);
+ }
+ use_vsync=p_use;
+
+}
+
+bool ContextGL_Win::is_using_vsync() const {
+
+ return use_vsync;
+}
+
Error ContextGL_Win::initialize() {
@@ -184,7 +198,7 @@ Error ContextGL_Win::initialize() {
printf("Activated GL 3.1 context");
}
-
+ wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress ("wglSwapIntervalEXT");
// glWrapperInit(wrapper_get_proc_address);
return OK;
@@ -194,6 +208,7 @@ ContextGL_Win::ContextGL_Win(HWND hwnd,bool p_opengl_3_context) {
opengl_3_context=p_opengl_3_context;
hWnd=hwnd;
+ use_vsync=false;
}
ContextGL_Win::~ContextGL_Win() {