summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2022-10-22 20:29:15 -0500
committerDavid Snopek <dsnopek@gmail.com>2022-11-08 18:47:11 -0600
commit23603e409c04fd0238a45552ad7b07a175b528c6 (patch)
treed47525574fbccaaa60e50e84f29603945eef607d /platform/windows
parent6d9546f16c505186196da677154de5f216b7eb9b (diff)
Add support for OpenGL to OpenXR
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/display_server_windows.cpp7
-rw-r--r--platform/windows/gl_manager_windows.cpp10
-rw-r--r--platform/windows/gl_manager_windows.h3
3 files changed, 19 insertions, 1 deletions
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();
};