Tutorial 1, modified to fit the NSOpenGLView lifecycle