Global variables are also necessary in some situations, unless you want to pass things around to every function in your program.
They are mostly not really necessary. Even if they seem to initially simplify things, global variables bring a lot of problems which aren't worth the trouble in the long term. If dependencies are kept local, they are much easier to maintain and to debug, while global variables can easily introduce unwanted side effects that are hard to track. Additionally, globals are a problem because of the undefined initialization and destruction order in multiple translation units, and because of the bigger complexity in multi-threaded programs.
Furthermore, it isn't true that you have to pass everything anywhere when you abandon global variables. As dependencies between different modules are now obvious, one tends to reflect twice before creating them, which leads to a more well-thought design. Of course, some parameters are necessary, but they mainly concern constructors. The passed argument can then be stored as class member and is automatically visible in member functions, but local to the class only.