From 23603e409c04fd0238a45552ad7b07a175b528c6 Mon Sep 17 00:00:00 2001 From: David Snopek Date: Sat, 22 Oct 2022 20:29:15 -0500 Subject: Add support for OpenGL to OpenXR --- platform/windows/display_server_windows.cpp | 7 ++++++- platform/windows/gl_manager_windows.cpp | 10 ++++++++++ platform/windows/gl_manager_windows.h | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'platform/windows') diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index d6ee712a31..2c8058fdc5 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -741,9 +741,14 @@ int64_t DisplayServerWindows::window_get_native_handle(HandleType p_handle_type, case WINDOW_HANDLE: { return (int64_t)windows[p_window].hWnd; } +#if defined(GLES3_ENABLED) case WINDOW_VIEW: { - return 0; // Not supported. + return (int64_t)gl_manager->get_hdc(p_window); } + case OPENGL_CONTEXT: { + return (int64_t)gl_manager->get_hglrc(p_window); + } +#endif default: { return 0; } diff --git a/platform/windows/gl_manager_windows.cpp b/platform/windows/gl_manager_windows.cpp index 7689751f1b..900bca8258 100644 --- a/platform/windows/gl_manager_windows.cpp +++ b/platform/windows/gl_manager_windows.cpp @@ -339,6 +339,16 @@ bool GLManager_Windows::is_using_vsync() const { return use_vsync; } +HDC GLManager_Windows::get_hdc(DisplayServer::WindowID p_window_id) { + return get_window(p_window_id).hDC; +} + +HGLRC GLManager_Windows::get_hglrc(DisplayServer::WindowID p_window_id) { + const GLWindow &win = get_window(p_window_id); + const GLDisplay &disp = get_display(win.gldisplay_id); + return disp.hRC; +} + GLManager_Windows::GLManager_Windows(ContextType p_context_type) { context_type = p_context_type; diff --git a/platform/windows/gl_manager_windows.h b/platform/windows/gl_manager_windows.h index 5e43a3de2a..c6d5f9f855 100644 --- a/platform/windows/gl_manager_windows.h +++ b/platform/windows/gl_manager_windows.h @@ -113,6 +113,9 @@ public: void set_use_vsync(bool p_use); bool is_using_vsync() const; + HDC get_hdc(DisplayServer::WindowID p_window_id); + HGLRC get_hglrc(DisplayServer::WindowID p_window_id); + GLManager_Windows(ContextType p_context_type); ~GLManager_Windows(); }; -- cgit v1.2.3