Field Operations

ArcGIS Runtime SDK for Qt: Migrating 10.2.5 Windows apps to 10.2.6 and DirectX

When you install 10.2.6, you will of course want to rebuild and run the projects you created in 10.2.5. When you do this on Windows, you may be unpleasantly surprised when your app crashes on start-up. Why does this happen?

ArcGIS Runtime SDK 10.2.6 for Qt builds for Windows use ANGLE instead of OpenGL for graphic drawing commands. Why? Because ANGLE translates OpenGL ES 2.0 API calls into DirectX 9 or DirectX 11 API calls. This is a good thing for Windows machines because this usually removes the need to install graphics drivers on machines before running your Runtime app. Even more importantly, DirectX is supported with Windows Remote Desktop Protocol, which allows you to run your apps over a Remote Desktop Connection, including connections to virtual machines. That’s new in 10.2.6, and massively useful.

That’s all great, but why does your 10.2.5 app crash when built with the 10.2.6 SDK? Because the 10.2.6 SDK libraries for Windows don’t include OpenGL libraries. When Qt attempts to access OpenGL libraries by default rather than use ANGLE, a crash results.

Luckily, there’s an easy fix to get your apps running again. Add this code at the beginning of your app.

#ifdef Q_OS_WIN
  // Force use of OpenGL ES through ANGLE on Windows 
  QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif

To see exactly where to place this code, have a look at the example in the Runtime SDK C++ and QML template applications. We have added this code at the beginning of main.cpp source file in both templates, so you don’t need to do it yourself in apps created with the 10.2.6 version of the app templates. Follow this example and rebuild, and you will be up and running again in no time.

For more information, see the ArcGIS Runtime SDK for Qt Release notes, and these external Web sites.

Next Article

A classical visualization of earthquakes using ArcGIS API for JavaScript

Read this article