Qualcomm© Snapdragon™ VR SDK  3.0.2
Qualcomm© Snapdragon™ XR SDK Documentation

Table of Contents

SDK Contents

The Snapdragon XR SDK is made up of the following elements

/3rdParty
    3rdParty libraries used by the SDK
/doc
    SDK documentation
/framework
    Common utility code used by the SDK samples
/samples
    Samples demonstrating use of the SXR SDK APIs
/include
    Core headers for interfacing with the SDK APIs
/lib
    Core libraries
/unity
    Unity plug-in necessary to create Unity applications utilizing the SDK

Integrating into native GL ES Applications

Snapdragon XR Libraries

After installing the Snapdragon XR SDK, modify the application's "Android.mk" file to pull in "libsxrapi.so" and "libqxrservice_client.so". This is done using the "PREBUILT_SHARED_LIBRARY" and "LOCAL_SHARED_LIBRARIES" commands in the Android NDK build system. See the Snapdragon XR sample or the Android NDK build documentation for more information.

Manually copy the file "sxrApi.jar" from the Snapdragon XR SDK to the "libs" directory in your application.

Application Manifest

In the application's build file "AndroidManifest.xml", change the "<application>" entry to include "android:hasCode="true"". This tells the Android build system that there will be Java code in the native application. If this is not done, the Android build system will not add the "sxrApi.jar" file to the final APK.

Application Java Activity

In order to include the Snapdragon XR SDK jar file in the final APK, your application must have at least a shell Java Activity class. This can be nothing more than an Activity that extents "android.app.NativeActivity". Its only function can be to call "System.loadLibrary( "sxrapi" )" and your application's library.

Be sure to modify "AndroidManifest.xml" to change the Activity name to this new Java class.

Android State Machine

Add the following Snapdragon XR calls to your native code:

android_main()
    Call "sxrInitialize()" before entering the main loop
    Call "sxrShutdown()" before the application exits
On APP_CMD_RESUME
    Call "sxrBeginXr()" if XR has been initialized
On APP_CMD_PAUSE
    Call "sxrEndXr()" if XR has been initialized and "sxrBeginXr()" has been called

Snapdragon XR API Calls

At the beginning of each frame, call "sxrGetPredictedDisplayTime()" to get the current amount of time your application is taking between the submition of a frame and the display of that frame. Pass this time in to "sxrGetPredictedHeadPose()" to get a quaternion representation of the current head orientation. See the Snapdragon XR API documentation for how to use these functions

Integrating into Unity Applications

Scene Setup

From a new or existing project import the Snapdragon XR SDK package from the Assets -> Import Package -> Custom Package menu, selecting the /unity/sxrUnityIntegration.unitypackage file from SDK release. Leave all of the boxes checked in the subsequent Unity dialog and select 'Import'

Create an instance of an SxrCamera rig by dragging the prefab from /Assets/SVR/Prefabs into the scene.

Transfer any scripts from existing non SvrCamera cameras in the scene over to the 'Left Eye' and 'Right Eye' cameras which are children of the SvrCamera/Head node

Remove and existing cameras other than the SvrCamera from scene

Player Settings

To access the Player settings select File->Build Settings, followed by selecting Android and choosing 'Player Settings'

In the 'Resolution and Presentation' section the Default Orientation must be set to 'Landscape Left'

In the 'Other Settings' section 'Multithreaded Rendering' must be disabled.

Quality Settings

In the project quality settings (Edit->Project Settings->Quality menu) the following options are recommended

Anisotropic Textures -> 'Per Texture' Anti Aliasing -> 'Disabled' Anti Aliasing can be enabled in the properties of the 'SvrCamera' node instantiated in the scene. Note that HDR must be disabled on the SvrCamera for antialiased eye buffers to be properly created V Sync Count -> 'Don't Sync'