HelloXR Sample Application
Khronos' OpenXR SDK Source repo includes the hello_xr sample app. This application can be used as a starting point to understand the basic functionality of OpenXR on a given device.
This topic describes downloading and building the the hello_xr sample app for Magic Leap 2.
Prerequisites
Complete the environment setup steps in Environment Setup.
Download the Project
- Clone or download the OpenXR-SDK-Source repository from GiHub by running the following command.
git clone https://github.com/KhronosGroup/OpenXR-SDK-Source.git
Make sure to use OpenXR SDK version 1.0.27 or higher.
Build and Run hello_xr
- Open Android Studio then select Open.
- Select the
hello_xr
folder, located in theOpenXR-SDK-Source\src\tests\hello_xr
. - If prompted, select Trust Project.
- Wait for the project to initialize.
Build Variants
The OpenXR runtime supports rendering using Vulkan and OpenGL ES.
The HelloXR test project includes graphics api plugin implementations for Vulkan and OpenGL ES, which are selectable by changing the build variant in Android Studio.
- To change the build variant in Android Studio, select Build > Select Build Variant.
- Choose VulkanDebug or OpenGLESDebug from the Active Build Variant dropdown.
Deploy and Run
- Connect the Magic Leap 2 connected to your computer.
- Ensure that "Magic Leap 2" is set as the target device.
Click the Run button to build and run the application on the Magic Leap.
Put on the Magic Leap to verify that the application built successfully.
The application renders several cubes around the user. A cube follows the users head pose in the center of the screen and another cube follows the controller's movement. Pressing the trigger button causes the controller to vibrate and the cube to shrink.