Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenXR + OpenGL or Vulkan on Windows #1

Open
lostmsu opened this issue Feb 4, 2020 · 1 comment
Open

OpenXR + OpenGL or Vulkan on Windows #1

lostmsu opened this issue Feb 4, 2020 · 1 comment

Comments

@lostmsu
Copy link

lostmsu commented Feb 4, 2020

Hi!

In the blog post you mentioned, that it is possible to use OpenGL with OpenXR. Is it actually possible on Windows? The runtime seems only be supporting DX...

@maluoi
Copy link
Owner

maluoi commented Feb 4, 2020

That's right! The implementation here is DirectX specific, but that's largely because it's the graphics API I'm good at, and my focus is on HoloLens which is DX only!

There's a few spots you'll need to make changes:


First one is a define up at the top! This activates code in openxr_platform.h:

#define XR_USE_GRAPHICS_API_D3D11

You can see some of the other defines on the spec here, you're probably looking for XR_USE_GRAPHICS_API_OPENGL!


xrCreateInstance activates extensions, so you'll need to ensure you've got the correct graphics API extension in that list! You can see here I'm using XR_KHR_D3D11_ENABLE_EXTENSION_NAME

const char          *extensions[] = { XR_KHR_D3D11_ENABLE_EXTENSION_NAME };
XrInstanceCreateInfo createInfo   = { XR_TYPE_INSTANCE_CREATE_INFO };
createInfo.enabledExtensionCount      = _countof(extensions);
createInfo.enabledExtensionNames      = extensions;
createInfo.applicationInfo.apiVersion = XR_CURRENT_API_VERSION;
strcpy_s(createInfo.applicationInfo.applicationName, 128, app_name);
xrCreateInstance(&createInfo, &xr_instance);

This is listed in the spec as a string, the openGL one is here, but you can also find the corresponding #define, XR_KHR_OPENGL_ENABLE_EXTENSION_NAME listed in openxr_platform.h!


The rest is going to be swapchain work! OpenXR takes your swapchain and displays it, so swapchain creation and display is a little dance done between the graphics API and OpenXR. This part is likely going to be the most tricky part, but I'm not up on OpenGL, so I can't give you much in the way of pointers here =/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants