A Program Object represents the compiled executable code, in the OpenGL Shading Language, for one or more Shader stages. A program object is an object in OpenGL, but it does not use the standard OpenGL Object model.
Empty program objects are created with this function:
This will return an empty program object. Programs are deleted with glDeleteProgram.
Once created, program objects must then be filled in with executable code. This is done by compiling shader objects and linking them into the program.
Before performing the linking steps for a shader, it is sometimes important to provide certain settings. OpenGL 3.3 or ARB_explicit_attrib_location has replaced the need for most of this, by allowing shaders to provide these settings itself.
A successfully linked program object can be queries for its various interfaces, so that the user can set uniforms and perform other upkeep on the object.
Outside of the state used by the pre-link setup, program objects have the following mutable state:
- The current values of all active uniform variables.
- The current bindings for any Uniform blocks.
- The current bindings for any Shader storage blocks.
Note that the last two pieces of state only need to be set if you did not set them directly in the shader.