The OpenXR Mobile SDK includes the resources necessary to use the OpenXR API for native development of VR apps for Oculus Quest and 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.
You can download the Oculus OpenXR Mobile SDK on our Downloads page.
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 OpenXR webpage.
You can learn about using OpenXR to develop VR apps by reading the OpenXR 1.0 Specification at the Khronos Group site. The site also offers API reference documentation and a PDF reference guide that provides a detailed 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 Quest 2.
When setting up an OpenXR project for Oculus Quest and Quest 2, add the following activity intent filter to AndroidManifest.xml
:
<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>
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.
Before loading can occur, the loader must be initialized with platform-specific parameters. These parameters are specified with the KHR loader extensions, XR_KHR_loader_init
and XR_KHR_loader_init_android
, added in the 1.0.11 OpenXR specification. Apps are required to first get the function pointer for xrInitializeLoaderKHR
via xrGetInstanceProcAddress
with a null instance pointer, and then call xrInitializeLoaderKHR
with the XrLoaderInitInfoAndroidKHR
struct defined in XR_KHR_loader_init_android
.
Apps are required to specify platform-specific parameters to xrCreateInstance
via the XR_KHR_android_create_instance
extension.
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:
/java/com/khronos/hello_xr/MainActivity.java
, load the openxr_loader
library before loading the application shared library: System.loadLibrary("openxr_loader");
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>
Before running 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