Mar 22, 2025
Learning graphics by writing the renderer yourself
I wanted to understand how vertices, transformations, and shaders become an image on screen. I started with an OpenGL flight simulator for a university course, then built a Vulkan renderer in C++.
Building the OpenGL flight simulator
For a Computer Graphics course at Dalhousie University, we were asked to build a 3D application in C++ using OpenGL and FreeGLUT.
I made a flight simulator with constant forward movement and keyboard-controlled vertical and lateral movement. The aircraft’s roll, pitch, yaw, and control surfaces animated in response to turns.
The rendering work included:
- Drawing polygons from vertex lists and setting up vertex buffer objects.
- Applying textures and lighting.
- Generating terrain with a custom random noise algorithm.
Debugging the camera and transformation matrices took time, but it helped me understand how the view and projection stages fitted together.
Learning Vulkan
Later, I followed Brendan Galea’s Vulkan C++ tutorial series, using GLFW for window management and GLM for vector and matrix math.
Vulkan required me to handle memory allocation, buffer staging, command buffers, render passes, framebuffers, descriptor sets, and synchronization explicitly. I also had to configure the graphics pipeline and bind SPIR-V shaders.
There was more setup code than in OpenGL. Working through it helped me understand operations that OpenGL and the driver had handled automatically.
How it changed my work with engines
I still use engines such as Unity or Godot when I want to build a game prototype. These projects gave me more context for draw calls, batching, depth testing, material passes, and GPU synchronization when using those tools.
Neither renderer was intended as a commercial product. I built them to learn, and they gave me a better understanding of the rendering systems I use in larger engines.