As a first step, we clone the Git repository, which houses the global Azure Remote Rendering samples. Open a command prompt (type cmd in the Windows start menu) and change to a directory where you want to store the ARR sample project.
Run the following commands:
Windows Command Prompt
mkdir ARR
cd ARR
git clone https://github.com/Azure/azure-remote-rendering
The last command creates a subdirectory in the ARR directory containing the various sample projects for Azure Remote Rendering.
The C++ HoloLens tutorial can be found in the subdirectory NativeCpp/HoloLens-OpenXr.
Build the project
Open the solution file BasicXrApp.sln located in the NativeCpp/HoloLens-OpenXr subdirectory with Visual Studio.
Switch the build configuration to Debug (or Release) and ARM64. Also make sure the debugger mode is set to Device as opposed to Remote Machine:
Since the account credentials are hardcoded in the tutorial's source code, change them to valid credentials. For that, open the file OpenXrProgram.cpp inside Visual Studio and change the part where the client is created inside the InitARR() function:
C++
// 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.AccountId, init.AccountKey, and init.AccountDomain to use your account data. See the paragraph about how to retrieve account information.
Specify where to create the remote rendering session by modifying the region part of the init.RemoteRenderingDomain string for other regions than westus2, for instance "westeurope.mixedreality.azure.com".
In addition, m_sessionOverride can be changed to an existing session ID. Sessions can be created outside this sample, for instance by using the PowerShell script or using the session REST API directly.
Creating a session outside the sample is recommended when the sample should run multiple times. If no session is passed in, the sample will create a new session upon each startup, which may take several minutes.
Now the application can be compiled.
Launch the application
Connect the HoloLens with a USB cable to your PC.
Turn on the HoloLens and wait until the start menu shows up.
Start the Debugger in Visual Studio (F5). It will automatically deploy the app to the device.
The sample app should launch and a text panel should appear that informs you about the current application state. The status at startup time is either starting a new session or connecting to an existing session. After model loading has completed, the built-in engine model appears right at your head position. Occlusion-wise, the engine model interacts properly with the spinning cubes that are rendered locally.
If you want to launch the sample a second time later, you can also find it from the HoloLens start menu, but note it may have an expired session ID compiled into it.
Next steps
Now that you have successfully compiled and deployed a native OpenXR sample with ARR capabilities, you can start enhancing the sample by adding interaction code for remote objects:
Use Azure Remote Rendering to render a 3D model in a Unity project. You can deploy the model to HoloLens 2 or use the power of mixed reality with the MRTK.