Left a comment that GL_FRAMEBUFFER_SRGB is supported by SDL2.
Fixed a bug with saving state. In addition, some minor code changes.