Added error checking for init and window creation.
Fixed window size being used as framebuffer size.
Added missing standard library headers.
Made OpenGL header inclusion portable.