# OpenGL (ES 2.0) Function Dependencies

In OpenGL (ES 2.0), there are many functions that can be called in any order, and still others that must be called after other functions had been called and not before.
For example, attaching a shader to a program requires a valid program so glAttachShader must be called after a call to glCreateProgram(). glCreateProgram() must be called after GL initialization etc.
Any functions that assume a certain "current" state, depend on the functions that set this state previously (defaults notwithstanding).
Such a dependencies necessary conditions for correct functioning (but not necessarily sufficient).

Is there a document or diagram somewhere that explicitly shows these dependencies and independencies? All I found were the occasional implicit mention in the texts.

This would be very helpful for debugging, learning and understanding the framework structure and also for developing higher-level tools that abstract away some of the low-level complexity.