Implemented vsync OS functions for OS X
This commit is contained in:
parent
b0c6213577
commit
5cf2fc3a5f
|
@ -212,6 +212,9 @@ public:
|
||||||
virtual void set_borderless_window(int p_borderless);
|
virtual void set_borderless_window(int p_borderless);
|
||||||
virtual bool get_borderless_window();
|
virtual bool get_borderless_window();
|
||||||
|
|
||||||
|
virtual void set_use_vsync(bool p_enable);
|
||||||
|
virtual bool is_vsync_enabled() const;
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
void set_mouse_mode(MouseMode p_mode);
|
void set_mouse_mode(MouseMode p_mode);
|
||||||
|
|
|
@ -1810,6 +1810,23 @@ Error OS_OSX::move_path_to_trash(String p_dir) {
|
||||||
return OK;
|
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::singleton = NULL;
|
||||||
|
|
||||||
OS_OSX::OS_OSX() {
|
OS_OSX::OS_OSX() {
|
||||||
|
|
Loading…
Reference in a new issue