Skip to main content
Version: 21 Aug 2024

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

  1. 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
tip

Make sure to use OpenXR SDK version 1.0.27 or higher.

Build and Run hello_xr

  1. Open Android Studio then select Open.
  2. Select the hello_xr folder, located in the OpenXR-SDK-Source\src\tests\hello_xr.
  3. If prompted, select Trust Project.
  4. Wait for the project to initialize.

Build Variants

tip

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.

  1. To change the build variant in Android Studio, select Build > Select Build Variant.
  2. Choose VulkanDebug or OpenGLESDebug from the Active Build Variant dropdown.

Deploy and Run

  1. Connect the Magic Leap 2 connected to your computer.
  2. Ensure that "Magic Leap 2" is set as the target device.
Magic Leap set as the Target device
  1. Click the Run button to build and run the application on the Magic Leap.

  2. Put on the Magic Leap to verify that the application built successfully.

Virtual Only Capture of the HelloXR Application from the Magic Leap 2

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.