OpenGL (ES 2.0) Function Dependencies


In OpenGL, 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().
Such a dependency a necessary condition (but not necessarily sufficient). glCreateProgram() must be called after GL initialization etc.
Any functions that assume a certain “current” state, depend on the functions that set this state.

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.


I don’t know of any diagram but the spec and man pages explicitly call out errors when the dependencies are not met. For the example you cite, the man page for glAttachShader says that “GL_INVALID_OPERATION is generated if program is not a program object.” The spec. contains similar language.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.