1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

vsync support

-works on windows
-may not work on X11, if so please fix
-OSX does not seem to support disabling vsync
This commit is contained in:
Juan Linietsky
2016-06-05 19:14:33 -03:00
parent 684a1207c0
commit 2420e46b44
14 changed files with 107 additions and 2 deletions

View File

@@ -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() {