mid's site

you're logged in as loser

🌍 Go Paperful

🔗 Subscribe via RSS

Journey into OpenGL: Introduction

JiOGL

  1. Introduction
  2. First Triangle
  3. Framebuffer and Depth Buffer
  4. Transformations
  5. Spaces
  6. Cube?
  7. Vertex Arrays
  8. Index Arrays
  9. 2D Textures
  10. Mipmapping
  11. ...

This series is still in beta, so contents may change.

Here I shall take you through a bottom-up approach to learning the OpenGL API, which you may use to draw high-performance digital 3D graphics across a wide range of platforms.

This guide will go through many nooks and crannies of OpenGL, from the first versions popularized by games such as Quake, to the ones of today that power the likes of Doom 2016. Rest assured, this will not negatively impact your skill as a programmer. Dare I say it will be improved, because:

  • There is plenty of wisdom to be found in old graphics programming practices - much creativity and ingenuity now lost because of modern conveniences.
  • Less boilerplate allows us to start off quicker.
  • Older versions naturally support more hardware. Though it's easy to point to statistics such as Steam surveys, the data there is heavily skewed. If my laptop is from 2009, it's obvious why I don't install Steam there. This old hardware still exists, however, abandoned yet more than ever still willing to help. Not using it would be negligence.
  • Lastly, it is practically guaranteed these old GL features will be available indefinitely, so you're hurting nobody by using them.

A common misconception is that OpenGL is a piece of software, but it is a specification, nothing more than a document. For each chip a separate driver must be written under this interface, and these chips have much freedom in how they work. Many times you will question the performance characteristics of a function, when there is no answer. On the other hand, it is this that gave OpenGL such portability.

OpenGL is easily compatible with many programming languages. Regardless, I shall be writing everything in C. If you decide on a different language, it's easy to port my code. I shall additionally use the following libraries:

  • GLFW, which will give us a window and an OpenGL context
  • glad, which will grant us access to the OpenGL interface
  • cglm, a linear algebra library

Alternatives to these libraries exist. With that said, let's get started.