Tweak up GLPaint from https://developer.apple.com/library/ios/samplecode/GLPaint/Introduction/Intro.html with undo function