Hi. So I’ve been trying to get OpenXR to work with a GLFW window. I tried all the repos online, none of them work. However, chapter 3 of the Khronos tutorial works.
So I copied the code from create instance, into another project that just used the OpenXR-SDK-main i downloaded off github.
I get the error xrCreateInstance failed -4
I can’t find anything online or here about error -4
The exact same code works in the chapter 3 tutorial.
I’ve compared the two projects, and besides using their own GFX library in the Khronos tutorials, they are exactly the same.
What are you setting in XrApplicationInfo.apiVersion? Older code and examples often use XR_CURRENT_API_VERSION which was fine when there was only OpenXR 1.0. Now OpenXR 1.1 is out and you need to be careful because few runtimes support OpenXR 1.1 yet.
XR_CURRENT_API_VERSION is a macro that is defined in openxr.h, which means that if your project brings its own openxr.h header from an OpenXR 1.0 SDK, it will resolve to an OpenXR 1.0 version. If openxr.h comes from an OpenXR 1.1 SDK, it will resolve to OpenXR 1.1.
Since OpenXR 1.1 the openxr.h header comes with the XR_API_VERSION_1_0 which is better to use because it won’t silently upgrade your OpenXR minor version by simply upgrading the openxr.h header.
Haha. I actually read about setting to older API version, but I accidentially set it in the chapter 3 example (which had an older SDK). When I set it in the correct project, it worked. Stupid med LOL