Picture of two zoetropes

Graphics APIs are the middlemen that connect visual-intensive software to the specialized pieces of hardware that render those graphics. As mobile hardware has seen huge advances in parallel processing power, developers have rushed to take advantage of it, and the competition between different APIs has gotten intense. But the difference between these APIs isn’t just technical–it’s a competition between two very different approaches to getting hardware and software to talk to one another. In this article, we’ll look at what graphics APIs are, how they work, and compare OpenGL and Metal, two of the biggest players in mobile graphics.

What Is Hardware Acceleration?

Before we get into the specifics of graphics APIs, it’s good to know a little about hardware acceleration in general. Hardware acceleration is the use of dedicated hardware, typically a Graphics Processing Unit (GPU), to perform computationally intensive work. Rather than CPUs, which are the general-purpose engines of computers, GPUs are designed to handle multiple intensive calculations in parallel. Hardware acceleration has applications in cryptography, data mining, and other types of work that benefit from parallelization. For most people, however, hardware acceleration is used to more quickly and efficiently render 3D graphics. Many of the most impressive effects seen in modern video games–think ultra-high-resolution textures, lifelike lighting, and atmospheric effects–are only possible thanks to hardware acceleration.

Graphics APIs

In order to take advantage of GPUs, applications rely on APIs. In the world of mobile graphics, there are a few major players. Next, we’ll take a look at how these APIs work and compare some of the major options for iOS.

Like other APIs, graphics APIs connect pieces of software to another resource. In this case, that resource is a piece of hardware, the GPU. This allows software developers to take advantage of the parallel processing power that GPUs use to handle the massive blocks of data and complex algorithms required to quickly render 3D images. However, not all graphics APIs work the same way. Some are high-level APIs designed to work across GPUs from multiple vendors. In the same way that high-level programming languages are designed to function no matter what type of system they’ll eventually run on (like Python, for example), high-level graphics APIs are meant to allow developers to focus on what they’re trying to accomplish rather than the details of technical execution. Of course, as with high-level programming languages, this level of abstraction comes at the expense of efficiency, particularly in the area of draw calls, which are instructions sent by the CPU to the GPU to render a given object. The longer it takes these instructions to reach the GPU, the slower the graphics become.

On the other end of the scale, low-level APIs give developers much more direct access to the specific hardware. The advantage here is similar to that of low-level programming languages (C++ is a good example), where the level of abstraction is minimal, giving the developer much greater control over how their instructions are executed in the underlying hardware. As a result, low-level APIs can take fuller advantage of a particular GPU’s architecture, resulting in speed and efficiency gains that would be impossible with a higher-level API. The downside to this is lower portability and less compatibility. A low-level API might only be compatible with GPUs designed using a particular, vendor-specific architecture. This can be a serious problem if you’re developing applications that are meant to be widely available.

Want to learn more about APIs? Check out Upwork’s guide to the API economy.

OpenGL: Designed for Flexibility

OpenGL (short for Open Graphics Library) is the quintessential high-level graphics API. It’s one of the oldest graphics APIs around, originally coming to prominence in the PC era. Despite it’s age, OpenGL has been continually updated and remains one of the most highly used APIs, especially in the arena of mobile games, where it’s supported by both iOS and Android. From a developer’s standpoint, the ability to write applications that can take advantage of hardware acceleration on both major mobile platforms can be a serious advantage, even if it comes at the expense of performance.

Metal: Designed for Speed

Metal is a low-level, proprietary API written in C++ that represents the latest in graphics API design. While high-level APIs like OpenGL are still used in many contexts, there’s been a definite trend over the last several years toward low-level APIs that can take advantage of the massive advancements in GPU speed.

Unlike OpenGL, which is hardware agnostic, Metal is designed specifically to work with Apple’s hardware architecture. From a developer standpoint, it allows you to take advantage of the particularities of Apple’s hardware directly, rather than relying on the API to handle it for you. In theory, this should allow you to achieve much higher performance than would be possible with a high-level API. Metal is also designed to be low overhead, meaning it eliminates many of the features that make OpenGL feel “heavy” or “bloated,” potentially adding to performance gains. Incidentally, these same qualities also make Metal better suited to computationally intensive tasks besides rendering 3D graphics. This could be a boon to mobile developers who are developing Computer-Assisted Design (CAD) or statistical software.

Open vs Closed

Apple is famous (or notorious) for its closed ecosystems. They design their own proprietary CPUs and operating systems, meaning it’s possible for Apple to reach a level of integration that’s impossible for their competitors. It makes sense, then, that they would want a proprietary graphics API to take advantage of that as well. The downside from a developer’s perspective is that while you can theoretically achieve extremely high levels of performance in this ecosystem, you’re also more “locked in,” making it much more time- and resource-intensive to create both Android and iOS versions of your applications. In the case of Metal, which is designed to work with Apple’s latest GPU architecture, this can even shut out users who are still using older Apple devices.

Which API is right for your team depends on the specifics of your application and your business goals. If your app depends on the latest and greatest in 3D graphics, it may make sense to go with a low-level API like Metal. If it’s more important that your application be able to run on as many platforms as possible, it may make sense to go with something higher-level. In either case, you’ll need experienced developers and 3D designers to bring your ideas to life.

Get more work done, faster with freelance help. Post your first project today. Let’s get started!