Native Samples

The mobile SDK includes a set of sample projects that prove out virtual reality application development on the Android platform and demonstrate high-performance virtual reality experiences on mobile devices.

Sample Applications and Media

The sample applications included with the SDK are provided as a convenience for development purposes. Some of these apps are similar to apps available for download from the Oculus Store. Due to the potential for conflict with these versions, we do not recommend running these sample apps on the same device on which you have installed your retail experience. If you are using the Samsung Note 4, please take care to secure the retail media content bundled with the SM-R320. It will be difficult if not impossible to replace.

Note: Due to limitations of Android ndk-build, your Oculus Mobile SDK must not contain spaces in its path. If you have placed your Oculus Mobile SDK in a path or folder name that contains spaces, you must move or rename the folder before you build our samples.

The following samples can be found in \VrSamples\Native\:

  • Oculus 360 Photos: A viewer for panoramic stills.
  • Oculus 360 Videos: A viewer for panoramic videos.
  • Oculus Cinema: Plays 2D and 3D movies in a virtual movie theater.
  • VrController: A simple scene illustrating use of the VrApi Input API.
  • VR Compositor: A simple scene illustrating use of the different layer types available with vrapi_SubmitFrame2.
  • VR Cube World: A simple scene with colorful cubes illustrating construction of basic native apps using different tools provided by the SDK. There are three versions of VR Cube World:
    • VrCubeWorld_SurfaceView is closest to the metal. This sample uses a plain Android SurfaceView and handles all Android Activity and Android Surface lifecycle events in native code. This sample does not use the application framework or LibOVRKernel - it only uses the VrApi. It provides a good example of how to integrate the VrApi in an existing engine. The MULTI_THREADED define encapsulates the code that shows how the VrApi can be integrated into an engine with a separate renderer thread.
    • VrCubeWorld_NativeActivity uses the Android NativeActivity class to avoid manually handling all the lifecycle events. This sample does not use the application framework or LibOVRKernel, it uses VrApi only. It provides a good example of how to integrate the VrApi in an existing engine that uses a NativeActivity. The MULTI_THREADED define encapsulates the code that shows how the VrApi can be integrated into an engine with a separate renderer thread.
    • VrCubeWorld_Framework uses Oculus Mobile Application Framework. When starting a new application from scratch without using a pre-existing engine, the application framework can make development significantly easier. The application framework presents a much simplified application lifecycle, allowing a developer to focus on the virtual reality experience without having to deal with many of the platform-specific details.

Installation

To install these sample applications and associated data to your mobile device, perform the following steps:

  1. Connect to the device via USB.
  2. Run installtophone.bat from your Oculus Mobile SDK directory, e.g.: C:\Dev\Oculus\Mobile\installToPhone.bat.
  3. Issue the following commands from C:\Dev\Oculus\Mobile\:
    adb push sdcard_SDK /sdcard/
    adb install -r *.apk
  4. Alternately, you may copy the files directly onto your mobile device using Windows Explorer, which may be faster in some cases.