Skip to content

Commit 562129b

Browse files
committed
log output improvements
1 parent 69235c5 commit 562129b

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

articles/remote-rendering/tutorials/native-cpp/hololens/integrate-arr-into-holographic-app.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ In this tutorial you will learn:
1616
> * Using Visual Studio to create a Holographic App that can be deployed to HoloLens
1717
> * Add the necessary code snippets and project settings to combine local rendering with remotely rendered content
1818
19-
This tutorial focuses on adding the necessary bits to a native `Holographic App` sample to combine local rendering with Azure Remote Rendering. It leaves out the parts for proper error- and status display inside the app (for example through text panels), because adding UI elements in native C++ is beyond the scope of this sample. Building a dynamic text panel from scratch is cumbersome as you need to deal with writing text to native `DirectX11` resources via `DirectWrite` and then render these resources as 3d overlays in the scene using custom shaders. A good starting point is class `StatusDisplay`, which is part of the
19+
This tutorial focuses on adding the necessary bits to a native `Holographic App` sample to combine local rendering with Azure Remote Rendering. The only type of status feedback in this app is through the debug output panel inside Visual Studio, so it is recommended to start the sample from inside Visual Studio. Adding proper in-app feedback is beyond the scope of this sample, because building a dynamic text panel from scratch involves a lot of coding. A good starting point is class `StatusDisplay`, which is part of the
2020
[Remoting Player sample project on GitHub](https://github.com/microsoft/MixedReality-HolographicRemoting-Samples/tree/master/player/common/Content). In fact, the pre-canned version of this tutorial uses a local copy of that class.
2121

2222
> [!TIP]
23-
> The [ARR samples repository](https://github.com/Azure/azure-remote-rendering) contains the outcome of this tutorial as a Visual Studio project that is ready to use. It is also enriched with proper error- and status reporting through UI class `StatusDisplay`. Inside the tutorial, all ARR specific additions are scoped by `#ifdef USE_REMOTE_RENDERING` / `#endif`, so it is easy to see what has been modified.
23+
> The [ARR samples repository](https://github.com/Azure/azure-remote-rendering) contains the outcome of this tutorial as a Visual Studio project that is ready to use. It is also enriched with proper error- and status reporting through UI class `StatusDisplay`. Inside the tutorial, all ARR specific additions are scoped by `#ifdef USE_REMOTE_RENDERING` / `#endif`, so it is easy to identify the Remote Rendering additions.
2424
2525
## Prerequisites
2626

@@ -323,11 +323,19 @@ void HolographicAppMain::StartModelLoading()
323323
m_modelLoadResult = *async->Status();
324324
m_modelLoadFinished = true; // successful if m_modelLoadResult==RR::Result::Success
325325
m_loadModelAsync = nullptr;
326-
});
326+
char buffer[1024];
327+
sprintf_s(buffer, "Remote Rendering: Model loading completed. Result: %s\n", RR::ResultToString(m_modelLoadResult));
328+
OutputDebugStringA(buffer);
329+
});
327330
m_loadModelAsync->ProgressUpdated([this](float progress)
328331
{
329332
// progress callback
330333
m_modelLoadingProgress = progress;
334+
335+
// output progress percentage to VS output
336+
char buffer[1024];
337+
sprintf_s(buffer, "Remote Rendering: Model loading progress: %.1f\n", m_modelLoadingProgress * 100.f);
338+
OutputDebugStringA(buffer);
331339
});
332340
}
333341
}
@@ -338,7 +346,22 @@ void HolographicAppMain::SetNewState(AppConnectionStatus state, RR::Result error
338346
{
339347
m_currentStatus = state;
340348
m_connectionResult = error;
341-
// status output here...
349+
350+
// some log for the VS output panel:
351+
const char* appStatus = nullptr;
352+
353+
switch (state)
354+
{
355+
case AppConnectionStatus::Disconnected: appStatus = "Disconnected"; break;
356+
case AppConnectionStatus::CreatingSession: appStatus = "CreatingSession"; break;
357+
case AppConnectionStatus::Connecting: appStatus = "Connecting"; break;
358+
case AppConnectionStatus::Connected: appStatus = "Connected"; break;
359+
case AppConnectionStatus::ConnectionFailed: appStatus = "ConnectionFailed"; break;
360+
}
361+
362+
char buffer[1024];
363+
sprintf_s(buffer, "Remote Rendering: New status: %s, result: %s\n", appStatus, RR::ResultToString(error));
364+
OutputDebugStringA(buffer);
342365
}
343366
344367
@@ -427,9 +450,9 @@ The last thing to do is invoking the rendering of the remote content. We have to
427450
428451
## Run the sample
429452
430-
The sample should now be in a state to compile and run.
453+
The sample should now be in a state where it compiles and runs.
431454
432-
When the sample runs properly, it shows the rotating cube right in front of you, and after some session creation and model loading, it renders the engine model located at current head position. Session creation and model loading may take up to a few minutes. There is no error- or state displaying integrated into this demo. So if something goes wrong (for example, authentication), there is no visible feedback and the engine model just won't appear. It is thus recommended to start the sample from inside Visual Studio and trace state transitions with breakpoints.
455+
When the sample runs properly, it shows the rotating cube right in front of you, and after some session creation and model loading, it renders the engine model located at current head position. Session creation and model loading may take up to a few minutes. The current status is only written to Visual Studio's output panel. It is thus recommended to start the sample from inside Visual Studio.
433456
434457
> [!CAUTION]
435458
> The client disconnects from the server when the tick function is not called for a few seconds. So triggering breakpoints can very easily cause the application to disconnect.

0 commit comments

Comments
 (0)