Refactor out OpenGL window handling.