Quickstart: Deploying a native C++ WMR sample on HoloLens

Quickstart: Deploying a native C++ WMR sample on HoloLens

Quickstart: Deploying a native C++ WMR sample on HoloLens

This quickstart explains how to deploy and run the native C++ Windows Mixed Reality tutorial app on HoloLens 2.

In this quickstart, you will learn how to do the following:

  • Build the tutorial app for HoloLens.
  • Change the Azure Remote Rendering credentials in the source code.
  • Deploy and run the sample on the device.

Previous requirements

To gain access to the Remote Rendering service, you must first create an account.

The following software must be installed:

  • Windows SDK 10.0.18362.0 or later.
  • The latest version of Visual Studio 2019.
  • The Visual Studio tools for Mixed Reality. Specifically, the following workload facilities are required :
    • Developing for the desktop with C++
    • Universal Windows Platform (UWP) development

Cloning the Remote Rendering Samples Repository

As a first step, we clone the Git repository, which hosts the global Azure Remote Rendering samples. Type cmdin the Windows Start menu to open a command prompt window. Change to the directory where you want to store the ARR sample project.

Run the following commands:

cd copy

mkdir ARR
cd ARR
git clone https://github.com/Azure/azure-remote-rendering

The last command creates a folder in the ARR folder that contains the various sample projects for Azure Remote Rendering.

The C++ HoloLens tutorial can be found in the NativeCpp/HoloLens-Wmr folder.

Project build

Open the HolographicApp.sln solution file located in the NativeCpp/HoloLens-Wmr folder with Visual Studio 2019.

Change the build settings to Debug (or Release ) and ARM64. Also make sure that the debugger mode is set to Device, and not Remote Machine :

Since the account credentials are hard coded in the tutorial source code, change them to valid credentials. Open the HolographicAppMain.CPP file within Visual Studio and change the part where the client is created within the constructor of the class HolographicAppMain:

C++Copy

// 2. Create Client
{
    // Users need to fill out the following with their account data and model
    RR::SessionConfiguration init;
    init.AccountId = "00000000-0000-0000-0000-000000000000";
    init.AccountKey = "<account key>";
    init.RemoteRenderingDomain = "westus2.mixedreality.azure.com"; // <change to the region that the rendering session should be created in>
    init.AccountDomain = "westus2.mixedreality.azure.com"; // <change to the region the account was created in>
    m_modelURI = "builtin://Engine";
    m_sessionOverride = ""; // If there is a valid session ID to re-use, put it here. Otherwise a new one is created
    m_client = RR::ApiHandle(RR::RemoteRenderingClient(init));
}

Specifically, change the following values:

  • init.AccountIdinit.AccountKeyand init.AccountDomainto use account data. See the section on retrieving account information.
  • Specify where you want to create the remote rendering session; to do this, modify the region portion of the string init.RemoteRenderingDomainto regions other than, for example "westeurope.mixedreality.azure.com".
  • Also, m_sessionOverrideit can be changed to an existing session identifier. Sessions can be created outside of this example. For more information, see RenderingSession.ps1 or Using the Session Management REST API Directly.

Creating a session outside of the sample is recommended when the sample needs to be run multiple times. If no session is passed, the example creates a session on every startup, which can take several minutes.

Now you can build the application.

Start the app.

  1. Connect the HoloLens device with a USB cable to the computer.
  2. Turn on HoloLens and wait for the boot menu to appear.
  3. Start the debugger in Visual Studio (F5). The app will be automatically deployed to the device.

The sample application starts and a text panel appears informing you of its current status. The state at startup is to start a new session or connect to an existing session. After the model upload is complete, the built-in engine model appears in the main position. With Occlusion Shape, the motor model correctly interacts with the spinning cube that is rendered locally.

If you want to start the example again later, you can also find it in the HoloLens start menu. It may have an expired session identifier compiled into it.

Next steps

This quickstart is based on the output of a tutorial that explains how to integrate all Remote Rendering related elements into a standard HoloLens Holographic. To know what the necessary steps are, follow this tutorial:

Leave a Reply

Your email address will not be published. Required fields are marked *