diff options
author | David Snopek <dsnopek@gmail.com> | 2022-10-22 20:29:15 -0500 |
---|---|---|
committer | David Snopek <dsnopek@gmail.com> | 2022-11-08 18:47:11 -0600 |
commit | 23603e409c04fd0238a45552ad7b07a175b528c6 (patch) | |
tree | d47525574fbccaaa60e50e84f29603945eef607d /platform/macos | |
parent | 6d9546f16c505186196da677154de5f216b7eb9b (diff) |
Add support for OpenGL to OpenXR
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/display_server_macos.mm | 5 | ||||
-rw-r--r-- | platform/macos/gl_manager_macos_legacy.h | 2 | ||||
-rw-r--r-- | platform/macos/gl_manager_macos_legacy.mm | 9 |
3 files changed, 16 insertions, 0 deletions
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 4478a635a8..33d8a8dd14 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -2932,6 +2932,11 @@ int64_t DisplayServerMacOS::window_get_native_handle(HandleType p_handle_type, W case WINDOW_VIEW: { return (int64_t)windows[p_window].window_view; } +#ifdef GLES3_ENABLED + case OPENGL_CONTEXT: { + return (int64_t)gl_manager->get_context(p_window); + } +#endif default: { return 0; } diff --git a/platform/macos/gl_manager_macos_legacy.h b/platform/macos/gl_manager_macos_legacy.h index 8752086551..d7ad5b1197 100644 --- a/platform/macos/gl_manager_macos_legacy.h +++ b/platform/macos/gl_manager_macos_legacy.h @@ -89,6 +89,8 @@ public: void set_use_vsync(bool p_use); bool is_using_vsync() const; + NSOpenGLContext *get_context(DisplayServer::WindowID p_window_id); + GLManager_MacOS(ContextType p_context_type); ~GLManager_MacOS(); }; diff --git a/platform/macos/gl_manager_macos_legacy.mm b/platform/macos/gl_manager_macos_legacy.mm index dec4821b86..ea5c36da6c 100644 --- a/platform/macos/gl_manager_macos_legacy.mm +++ b/platform/macos/gl_manager_macos_legacy.mm @@ -215,6 +215,15 @@ bool GLManager_MacOS::is_using_vsync() const { return use_vsync; } +NSOpenGLContext *GLManager_MacOS::get_context(DisplayServer::WindowID p_window_id) { + if (!windows.has(p_window_id)) { + return nullptr; + } + + GLWindow &win = windows[p_window_id]; + return win.context; +} + GLManager_MacOS::GLManager_MacOS(ContextType p_context_type) { context_type = p_context_type; } |