Skip to main content

Khronos Blog
Khronos Releases New OpenXR Tutorial Banner

Khronos Releases New OpenXR Tutorial

Self-guided tutorial provides sample code and detailed instructions teaching developers to create interactive OpenXR applications using Windows, Linux, or Android and a variety of graphics APIs.

The Khronos Group has released a free OpenXR Tutorial, designed to guide software developers through every step of creating an OpenXR application using Windows, Linux or Android. This web-based tutorial, produced by the OpenXR Working Group, is packed with detailed instructions, downloadable archives, and example code snippets to support developers as they set up an OpenXR development environment, connect to their preferred graphics API, and incorporate interactivity, extensions, and other advanced features.

OpenXR was created to help address fragmentation in the XR ecosystem. Before OpenXR, software developers had to write different code paths for every hardware platform, using a different, often proprietary API for each device. OpenXR provides a common API to address AR, VR, MR (collectively known as XR) hardware. Using OpenXR, developers can write code that works with multiple XR platforms with minimal adaptation.

OpenXR isn’t a specific library or code: instead, there are multiple runtimes provided by hardware manufacturers, software companies, and even open source projects. Any OpenXR-compliant code will work with any OpenXR compliant runtime. The OpenXR Tutorial is designed to give developers the building blocks they need to create cross-platform applications for any OpenXR runtime.

Choose Your Own Environment

The OpenXR Tutorial has detailed instructions for creating applications using the Android, Linux or Windows operating system. Currently supported graphics APIs include:

The OpenXR Tutorial is intended for software developers who are familiar with at least one of these compatible graphics APIs. Developers begin the OpenXR Tutorial by selecting the graphics API and platform they plan to use. The tutorial branches from that point forward to provide the appropriate guidance – though developers can change platform/API at any time.

From Setup to Advanced Topics

The OpenXR Tutorial is divided into six chapters, each building upon the last:

  • Introduction
  • OpenXR Setup – teaches developers how to create an instance, create a session, and poll the OpenXR event-based system to handle changes within the XR system.
  • Graphics – demonstrates the interaction between OpenXR and the graphics API, equipping developers to build applications with color, depth and geometry.
  • Interactions – teaches developers how to add interactivity to an application using the OpenXR Interaction System.
  • Extensions – demonstrates how to add extensions to the core OpenXR API, using hand tracking and composition layer depth as examples.
  • Next Steps – describes optional steps to further enhance or add capabilities to an application, including multiview rendering, multithreaded rendering, OpenXR API Layers, and more.

The first five chapters walk developers through the creation of a simple XR application, providing example code and detailed explanations of each concept along the way. By following the tutorial, developers will create a simple interactive VR program that allows the user to play with and build structures out of colored cubes.

The final chapter invites developers to get creative. It introduces advanced topics for further exploration, with examples and links to additional materials to help developers continue their journey with OpenXR.

Basic Requirements

Developers will need the following to complete the tutorial:

  • A Windows or Linux PC to compile the code.
  • An IDE (integrated development environment) that supports the target device: either Visual Studio 2017 or later; or Android Studio.
  • Some XR hardware to run on. This could be an XR device that connects to the PC or an Android-based device like a Meta Quest or Pico Neo. It is also possible to use Monado to emulate XR hardware.
  • CMake 3.22.1
  • Python 3.6+

Explore the Tutorial

Khronos invites all interested developers to dive into the OpenXR Tutorial and explore the fundamentals of creating cross-platform AR and VR applications. Feedback and questions are welcome on the OpenXR Discord, OpenXR Forums, or Issue Tracker.

The OpenXR tutorial is licensed as Creative Common International 4.0 By Attribution (CC-BY), and the code in the tutorial is licensed as Apache 2.0. The full source code for the tutorial is also available on GitHub.

Comments