diff options
Diffstat (limited to 'platform/osx/os_osx.mm')
-rw-r--r-- | platform/osx/os_osx.mm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 2c81a02014..e1a01d2b59 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1954,6 +1954,23 @@ Error OS_OSX::move_to_trash(const String &p_path) { return OK; } +void OS_OSX::set_use_vsync(bool p_enable) { + CGLContextObj ctx = CGLGetCurrentContext(); + if (ctx) { + GLint swapInterval = p_enable ? 1 : 0; + CGLSetParameter(ctx, kCGLCPSwapInterval, &swapInterval); + } +} + +bool OS_OSX::is_vsync_enabled() const { + GLint swapInterval = 0; + CGLContextObj ctx = CGLGetCurrentContext(); + if (ctx) { + CGLGetParameter(ctx, kCGLCPSwapInterval, &swapInterval); + } + return swapInterval ? true : false; +} + OS_OSX *OS_OSX::singleton = NULL; OS_OSX::OS_OSX() { |