I have been reading the OpenGL Programming Guide, and in it they justify usage of global variables in tutorials on the grounds that they are just small programs in the examples. The question I have is if there is some piece of information about global variables that I don't understand that would justify that? I am familiar with scope, but I am trying to understand why you would risk the possibility of teaching something that is considered to be bad practice (as far as I have ever heard; also, I realize that the book I am referring to is not to teach programming, but OpenGL), when you could just avoid using the globals?
So in essence, is there a difference that I simply am not understanding that makes their use appealing for such tutorials?
When I took a course in computational physics, the professor seemed to love global variables, and it took me a bit to get past that, as I had read often that one should avoid them. Every C program that we looked at in class had almost every piece of information related to the values of the elements of the simulation placed in variables that were at the top of the source file, right below the includes and defines. I believe that I read that C variables are not actually strictly globals in that context, so my usage of the term may be incorrect.