Switch to forward-compatible OpenGL 3.1 context

Code is now verified up to OpenGL 4.1. Keeping it 3.1 for now to avoid
advanced features which may not be supported on older hardware.