The OpenXR Mobile SDK includes the resources necessary to use the OpenXR API for native development of VR apps for Oculus Quest and Oculus Quest 2. OpenXR offers an alternate development path that allows developers to create portable code that can be used on devices from multiple vendors. Oculus Quest and Oculus Quest 2 are 1.0 adopters of OpenXR.
OpenXR is a royalty-free open standard from the Khronos Group created for the development of high-performance VR applications that run on multiple platforms. OpenXR aims to simplify VR development by enabling developers to reach more platforms while reusing the same code. To read more about OpenXR, see the Khronos Group's OpenXR webpage.
Product is based on a published Khronos specification and is expected to pass the Khronos Conformance Process when available. Current conformance status can be found at www.khronos.org/conformance.
You can learn about using OpenXR to develop VR apps by reading the OpenXR 1.0 Specification at the Khronos Group web site. The Khronos Group also provides API reference documentation and a PDF reference guide that provides an overview of the API.
In addition to the documentation from the Khronos Group, this section contains information necessary to develop OpenXR apps for Oculus Quest and Oculus Quest 2.
When setting up an OpenXR project for Oculus Quest or Quest 2, add the following activity intent filter to
<action android:name="android.intent.action.MAIN" /> <category android:name="com.oculus.intent.category.VR" /> <category android:name="android.intent.category.LAUNCHER" />
OpenXR 1.0 did not include a standard Android loader, and as such Oculus has provided a custom Android loader. The loader library can be found at
/OpenXR/Libs/Android/ in this SDK package.
On Android, before loading can occur, the loader must be initialized with platform-specific parameters. These parameters may be specified with the new provisional KHR loader extensions,
The provisional KHR loader extensions XR_KHR_loader_init and
XR_KHR_loader_init_android are currently defined in
/OpenXR/Include/openxr_oculus.h. While provisional, it is possible that the extension are subject to change, but we do not anticipate any changes to these specs. When they are final, they will be defined in
openxr.h. On Android, apps are required to first get the function pointer for
xrGetInstanceProcAddress with a null instance pointer, and then call
xrInitializeLoaderKHR with a the XrLoaderInitInfoAndroidKHR struct defined in
Due to how the mobile runtime is loaded, the app is required to specify the application JVM and activity. This information is provided at
xrCreateInstance time via
XR_KHR_android_create_instance. However, OpenXR allows specific entry points to be called before
xrCreateInstance. In those cases, the application will be required to first call
xrInitializeLoaderKHR providing a valid application JVM and activity.
This section walks you through the steps of getting started with
hello_xr, a simple cross-platform OpenXR sample in the Khronos Group’s OpenXR-SDK-Source GitHub repository at https://github.com/KhronosGroup/OpenXR-SDK-Source/tree/master/src/tests/hello_xr. Since there is not currently a standard Android OpenXR Loader, some modifications must be made to the sample in order to load the OpenXR runtime on Oculus systems:
Link against the Oculus OpenXR loader library in this package at
/java/com/khronos/hello_xr/MainActivity.java, load the
openxr_loader library before loading the application shared library:
Add the following activity intent filter to
AndroidManifest.xml at the application scope:
<action android:name="android.intent.action.MAIN" />
<category android:name="com.oculus.intent.category.VR" />
<category android:name="android.intent.category.LAUNCHER" />
hello_xr, make sure to specify the graphics plugin to use with one of the following adb commands:
adb shell setprop debug.xr.graphicsPlugin.OpenGLES
adb shell setprop debug.xr.graphicsPlugin.Vulkan