Various fixes for use of GLFW

These are various fixes to the parts of the tutorial framework. 62a3f84 and 3d23cff fix portability issues, while 3ab835c and 93b6ea2 fixes issues that affect OS X as well.