What Even Is An OpenGL?

Whenever I talk to a non-developer or non-game-developer about what I do for a living, there’s a good chance I’m going to need to explain what OpenGL is. It’s tricky… because to be honest, I don’t fully understand what OpenGL is myself. That must sound ludicrous given that I interact with it every single day… and most days most of what I do relates to it in some way.

But you can say about OpenGL the same thing that you can say about computers as a whole: it’s a tremendously expansive field with so many subtopics that you could never explore them all. Just as there is no single human who understands how to build an entire modern computer from scratch, there is no single human who understands wholly what takes place when a modern graphics card makes an image appear on a monitor. Still, there are humans who understand parts of this process… and I certainly am one of those humans. So I’ll tell you what OpenGL is to me, a 2D mobile game developer.

I'm A 2D Mobile Game Developer

But First, Let Me Google That For You

Just to demonstrate what an enormous idea OpenGL is, let’s look it up on the internet. Wikipedia seems to think this:

Open Graphics Library (OpenGL) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering.

Thanks, Wikipedia! I don’t know about you, but I didn’t get much out of that. I mean there were lots of words, and it definitely said something, but when you put it all together it mostly evaporates. I think the problem is that we’re trying to ingest the entire burrito in one bite. OpenGL means too many things to too many different people to summarize all of those things effectively in two sentences.

Basically, we can gather that OpenGL is an industry-standard system that lets computer hardware draw pictures on screens. Duh. But what does that really mean?

Start Over

Okay, so let’s try a different approach. Like good little software engineers, we’ll start by limiting the scope. Let’s look at a specific example of OpenGL in action and try to understand where, exactly, it fits in. Think of an iPhone game.

Stir Fry!

That’s a screenshot from Stir Fry, an iOS game I wrote long, long ago when the App Store was young. Sorry–you can’t download it anymore. But look at those happy vegetables!

As iPhone game architectures go, Stir Fry’s is pretty standard. I wrote the game using an open-source game engine called Cocos2D. But hold on–what’s a game engine? It’s an important component of a typical game’s structure. Like so many other concepts in Computerworld, an iOS game’s graphical architecture looks a lot like a layer cake.

Tasty Graphics Architecture Layer Cake

We’ll break down these layers one-at-a-time.

A Mosaic Of A Vegetable

And there you have it! I’m sure I oversimplified and conflated more than a few concepts in there, but I hope you were able to get some sense of what OpenGL is and where it fits in a game’s graphical architecture. The borders tend to blur together, but you get the idea. In the real world, there’s a lot more to consider whenever you’re working with OpenGL. I didn’t even touch on performance or engine design or shaders or anything. But you have to start somewhere! Hopefully I’ll get a chance to tackle some of those more advanced topics soon. Until then!

rss facebook twitter github youtube mail spotify instagram linkedin google pinterest medium vimeo