Getting Started with Vuforia Engine for Windows 10 Development

This article explains how to start developing for Windows 10 with Vuforia Engine in both Unity and Visual Studio. Vuforia Engine supports the development of Universal Windows Platform (UWP) apps on select Intel and ARM based Windows 10 devices, including Microsoft Surface and HoloLens. The Engine SDK and Vuforia Samples use C# APIs for Unity development and C APIs for native development.

The Vuforia Engine Supported Versions page lists the operating systems and tools that are supported for developing apps with the Engine platform. Additional information about recommended devices can be found here. You can also use the Direct3D 12 programmable pipeline to create realtime 3D graphics for games as well as scientific and desktop applications.

For information about event logs generated by Vuforia Engine, refer to the Capturing and Viewing Event Logs with ETW article

Developing for Windows 10 in Unity

Before proceeding, familiarize yourself with the contents of the Getting Started with Vuforia Engine for Unity Development article. It contains information on installing Unity, activating Vuforia Engine within your project, and accessing Vuforia Engine features. 

When you build a UWP app in Unity, a Visual Studio project is generated and launched.  You can then build and run the project from Visual Studio. For information on packaging your app for all UWP devices, refer to the Getting Started with Windows UWP Apps article.

The HoloLens and Core samples, available in the Developer Portal or the Unity Asset Store, lay out the structure and organization of a Vuforia Windows 10 Unity project. The samples are complete Unity projects, including pre-configured scenes that implement Image Targets, Model Targets, and VuMarks. 

To gain a better understanding of how to develop for Windows 10 in Unity, start by performing the steps in the Working with the HoloLens Sample in Unity article.

Developing for Windows 10 in Visual Studio

This section explains how to set up the Vuforia Engine for UWP and the Vuforia Engine Sample in the latest supported Visual Studio version.

  1. Download the Vuforia Engine for UWP.
  2. Unpack the Vuforia Engine for UWP to a folder in your development environment.
  3. Download the Vuforia Engine Sample for UWP.
  4. Unpack the Vuforia Engine Sample for UWP in to the Samples folder located in the Vuforia Engine for UWP folder.
  5. In the extracted folder, open VuforiaSamples.sln  in the UWP  subfolder.
    The sample project loads in Visual Studio.

Building and Executing the Sample

  1. Use the Licenses tab to create a license key. Refer to the Engine Developer Portal Licenses article for more information.
  2. Add the license key to your sample project. The license key can be defined in the namespace of your app.
    namespace
    {
        constexpr char licenseKey[] = "";
    }
  3. In the Solution Platforms dropdown, select the correct platform for your target device.
  1. Build and run the sample.
    NOTE: If Visual Studio does not recognize the include path for the sample project, perform the following steps:
    1. In the Solution Explorer window, right-click the VuforiaSample project and select Properties.
    2. Expand the General menu.
    3. In the Include Directories field, add the path to the include directories.
  1. Package your app for all UWP devices by following the instructions in the Packaging Universal Windows apps for Windows 10 article. 

Upon startup of the Vuforia Engine Sample app, a main menu is shown on your device, from which you can select between the Image Targets or Model Targets feature:

You have successfully deployed your first application with Vuforia Engine!
Tap the screen once to trigger the camera to focus, or double-tap to go back to the main menu.

Modifying the Sample

Obtaining the State

The State object contains references to all current Observations. You can obtain Observations from the vuEngineAcquireLatestState , as shown in the prepareToRender() method in CrossPlatform/AppController.cpp.

vuEngineAcquireLatestState(mEngine, &mVuforiaState)

Querying Observation results

You can get the Observations from the state for each Observer which can be specified to access pose, type, and status info.

An example of this can be seen in the sample with the getImageTargetResult method in CrossPlatform/AppController.cpp.

VuObservationList* observationList = nullptr;
vuObservationListCreate(&observationList);

if (vuStateGetImageTargetObservations(mVuforiaState, observationList) != VU_SUCCESS)
{
        LOG("Error getting image target observations");
        REQUIRE_SUCCESS(vuObservationListDestroy(observationList));
        return false;
}
VuPoseInfo poseInfo;
vuObservationGetPoseInfo(observation, &poseInfo);

VuImageTargetObservationTargetInfo imageTargetInfo;
vuImageTargetObservationGetTargetInfo(observation, &imageTargetInfo);

Troubleshooting

In some situations, when you use the debugger in Visual Studio with UWP apps that integrate Vuforia Engine, the app might fail to run and report a network connection issue with a winrt::hresult_error exception. To work around this, go to Debug -> Windows -> Exception Settings (Breakpoints on Mac) and clear the checkmark for the winrt::hresult_error exception. This allows the Vuforia Engine to work properly with the attached debugger.

For general troubleshooting and debugging, see Troubleshooting your App.

Camera

If you have trouble getting Vuforia Engine to recognize a USB webcam attached to a Windows tablet or laptop with a built-in back camera (camera facing away from the user), you can disable that camera in Windows Settings - Device Management. It allows Vuforia Engine to prioritize the USB webcam.

See also Vuforia Camera Bridge for connecting external cameras to UWP devices.

Can this page be better?
Share your feedback via our issue tracker