This appendix includes OpenGL programming tips designed to improve code reusability and reduce application bugs. Some topics covered will also help improve application performance, but for more performance information, see Appendix C, “Performance.”
OpenGL is a state machine, and when your application puts OpenGL in a certain state, OpenGL stays in that state until code changes it to another state. Often, this is the behavior you want. Many applications typically enable depth testing with
( GL_DEPTH_TEST ) at init time, for example, and leave it enabled for the duration of their program execution.
If state isn’t set the way you want it, however, OpenGL probably won’t produce the results you want. ...