Developer Preview Disclaimer: This is a prototype version of OpenXR support that is presented as a developer preview. We don't recommend submitting apps developed using OpenXR until support exits the developer preview phase.
The OpenXR Mobile SDK includes the resources necessary to use the OpenXR API for native development of VR apps for Oculus Quest. OpenXR offers an alternate development path that allows developers to create portable code that can be used on devices from multiple vendors.
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.
When setting up an OpenXR project for Oculus Quest, 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.
The Oculus specific loader extension,
XR_OCULUS_android_initialize_loader, can be found in
/OpenXR/Include/openxr_oculus.h. Apps are required to first call
XR_OCULUS_android_initialize_loader if they intend to call OpenXR entry points before calling
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
xrInitializeLoaderOCULUS 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_oculus library before loading the application shared library:
Call the following Oculus loader extension function (
<openxr/openxr_oculus.h>) from the
memset(&loaderInitializeInfoAndroid, 0, sizeof(loaderInitializeInfoAndroid));
loaderInitializeInfoAndroid.type = XR_TYPE_LOADER_INITIALIZE_INFO_ANDROID_OCULUS;
loaderInitializeInfoAndroid.next = nullptr;
loaderInitializeInfoAndroid.applicationVM = data->applicationVM;
loaderInitializeInfoAndroid.applicationActivity = data->applicationActivity;
Add the following activity intent filter to
AndroidManifest.xml at the application scope:
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.oculus.intent.category.VR" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
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