Switch to SDL2 (untested).

-std=c99 is needed because SDL uses `inline' (let's hope that it does not
assume GNU C semantics).
Use the SDL2 rendering API instead of OpenGL.

The OpenGL code wasn't exactly exemplative anyway; this is also more portable.
Compare pointers with NULL explicitly.
Roll our own err/errx/warnx, for portability.

They are very nice, but unfortunately non-standard.