Various fixes for use of GLFW

These are various fixes to the parts of the tutorial framework. 7277df0 and 30f57b2 fix portability issues, while 94df80b and ea55140 fixes issues that affect OS X as well.