Program Object

From OpenGL Wiki
Revision as of 01:45, 4 March 2013 by Alfonse (talk | contribs) (General page on program objects.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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:

GLuint glCreateProgram()

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.

Pre-link setup

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.

State setting

Outside of the state used by the pre-link setup, program objects have the following mutable state:

Note that the last two pieces of state only need to be set if you did not set them directly in the shader.