Posted on March 21, 2021

Source code

This project is the code I was left with after I went through the breakout tutorial at LearnOpenGL. There’s a slight twist though: I did it using OCaml rather than C++. At the time, I was interested in game programming in general, but also in what good a language like OCaml could be for games, so I decided to make it a two-fold exercise. The final game is exactly the same as the C++ version at the end of the tutorial.

Trying to find natural ways to transform object-oriented code into functional code was a fun endeavor, but the biggest headache came from an unexpected place: linking to external C libraries. This is a very straightforward task in the normal course of the tutorial, but in an OCaml context it requires the additional work of binding to the C code. For some of the libraries, there was no binding already available and I had to do them myself, which turns out to be quite complicated if you want to do it the right way.

Comment on the implementation

see the readme of the project, where I included more implementation details.