mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-08 12:29:45 +02:00
OpenXrContext: Add Windows platform and bindings. (Untested)
This commit is contained in:
parent
7b1bbb6b2d
commit
80c7b8f993
1 changed files with 18 additions and 4 deletions
|
@ -11,9 +11,15 @@
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <GL/glx.h>
|
#if defined(Q_OS_LINUX)
|
||||||
|
#include <GL/glx.h>
|
||||||
|
#define XR_USE_PLATFORM_XLIB
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
|
#define XR_USE_PLATFORM_WIN32
|
||||||
|
#else
|
||||||
|
#error "Unsupported platform"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define XR_USE_PLATFORM_XLIB
|
|
||||||
#define XR_USE_GRAPHICS_API_OPENGL
|
#define XR_USE_GRAPHICS_API_OPENGL
|
||||||
#include <openxr/openxr.h>
|
#include <openxr/openxr.h>
|
||||||
#include <openxr/openxr_platform.h>
|
#include <openxr/openxr_platform.h>
|
||||||
|
@ -178,14 +184,22 @@ bool OpenXrContext::requestExitSession() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenXrContext::initSession() {
|
bool OpenXrContext::initSession() {
|
||||||
// TODO: Make cross platform
|
#if defined(Q_OS_LINUX)
|
||||||
XrGraphicsBindingOpenGLXlibKHR binding = {
|
XrGraphicsBindingOpenGLXlibKHR binding = {
|
||||||
.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR,
|
.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR,
|
||||||
.xDisplay = XOpenDisplay(nullptr),
|
.xDisplay = XOpenDisplay(nullptr),
|
||||||
.glxDrawable = glXGetCurrentDrawable(),
|
.glxDrawable = glXGetCurrentDrawable(),
|
||||||
.glxContext = glXGetCurrentContext(),
|
.glxContext = glXGetCurrentContext(),
|
||||||
};
|
};
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
|
XrGraphicsBindingOpenGLWin32KHR binding = {
|
||||||
|
.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR,
|
||||||
|
.xDisplay = wglGetCurrentDC(),
|
||||||
|
.glxContext = wglGetCurrentContext(),
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
#error "Unsupported platform"
|
||||||
|
#endif
|
||||||
XrSessionCreateInfo info = {
|
XrSessionCreateInfo info = {
|
||||||
.type = XR_TYPE_SESSION_CREATE_INFO,
|
.type = XR_TYPE_SESSION_CREATE_INFO,
|
||||||
.next = &binding,
|
.next = &binding,
|
||||||
|
|
Loading…
Reference in a new issue