Skip to main content

VRNativeApplication

Description

Building on the NativeApplication, VRNativeApplication introduces a basic VR environment. This demo integrates an OpenXR session and sets up Ocean's OpenGL ES rendering engine, ready to render simple primitive objects.

However, the app does not render any content; it is merely ready to create your own VR experience.

Image: Hierarchy of Ocean's Quest environments

The entire app is realized with only four source files. The main class, OpenXRVRNativeApplication, is derived from Platform::Meta::Quest::OpenXR::Application::VRNativeApplication, which serves as the base class for all of Ocean's Quest applications with integrated OpenXR sessions and OpenGLES-based rendering engines. The base class handles the entire setup of OpenXR (e.g., spaces, actions, compositor layers) and initializes the stereo framebuffer while handling the necessary render calls. Furthermore, controller tracking is enabled and ready to be used.

To transform the demo app into a fully functional VR experience, you simply need to incorporate some 3D content for rendering. This content should be added within the onFramebufferInitialized() event function, which is triggered after the rendering framebuffer has been initialized.

The subsequent demo app, Renderer, demonstrates precisely this process.

Building

The following instructions are for macOS but can be easily converted to other host operating systems. First, ensure that the

have been completed. And that the third-party libraries have been built according to these instructions.

Then run the following steps:

# Define environment variables required for Android and Quest apps as per setup instructions above:
# ANDROID_HOME, ANDROID_NDK, ANDROID_NDK_VERSION, JAVA_HOME, and OVRPlatformSDK_ROOT

# Adjust this to your location of the third-party libraries
export OCEAN_THIRDPARTY_PATH="${HOME}/install_ocean_thirdparty"

cd ${OCEAN_DEVELOPMENT_PATH}/build/gradle/application/ocean/demo/platform/meta/quest/openxr/vrnativeapplication/quest

./gradlew assemble

# Install debug build of the app
adb install app/build/outputs/apk/debug/app-debug.apk

# Install release build of the app
adb install app/build/outputs/apk/release/app-release.apk

Features

  • Integrated OpenXR Session: Unlike the NativeApplication, this demo includes an OpenXR session setup.
  • Integrated Rendering Engine: Ready to render simple primitive objects using Ocean's OpenGL ES rendering engine.

Usage

  • Log Verification: Similar to the NativeApplication, this app does not provide visual feedback upon starting. Use the following commaned to verify its operation:
adb logcat -s Ocean