Improving the Graphics Layer

Today's goal: Switch from SDL2 to GLFW and get something rendering!

Updates

  • Special thanks to Felipe Balbi for spending a lot of time improving the quality of the code and build!

Switching to GLFW

Today we're going to spend some time moving the graphics layer from SDL2 to GLFW.

At some point we might even get rid of GLFW, but we'll stick with this path for a while :)

Benefits

  • Direct access to OpenGL rendering APIs without bringing in everything else SDL2 offers
  • No unnecessary code for playing sounds and other game-specific functionality
  • We can write our own APIs that wrap what GLFW and OpenGL provide

Drawbacks

  • Have to write our own image loading code
  • Have to write our own font handling code
  • Have to write optimized rendering routines

But as I've said before, that's the point :)

Tasks

DONE Figure out a good pattern for starting the render/event loop

DONE Add basic event loop

DONE Add screen clearing function

DONE Add rect rendering function

DONE Delete SDL2 code and dependencies

Next Steps

TODO Try to add PNG loading/rendering

TODO See if we can render the OpenGL context back to a PNG

TODO (Maybe) Add SIGTERM handler for cleaning up graphics resources