The problem is that you call SDL_Quit() when escape is pressed. Then your loop
goes on to execute SDL functions (i.e. SDL_GL_SwapBuffers()), which won't work after you've called SDL_Quit().
So, here's what I suggest you do. Instead of calling SDL_Quit(), use
I'd then follow your logic to make sure SDL_Quit() is called eventually.
I compiled and ran your project under Linux with no troubles, in case you're interested about portability.
BTW, please put a default case where you switch on an SDLKey -- with warnings enabled, you get hundreds of warnings about unhandled enumeration values . . . .