Difference between revisions of "Program Object"

From OpenGL Wiki
Jump to navigation Jump to search
m (fixing category)
(Converted to redirect to GLSL Object page.)
 
Line 1: Line 1:
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|OpenGL Object model.]]
+
#REDIRECT [[GLSL Object#Program objects]]
 
 
== Creation ==
 
{{main|Shader Compilation}}
 
 
 
Empty program objects are created with this function:
 
 
 
{{funcdef|GLuint {{apifunc|glCreateProgram}}()}}
 
 
 
This will return an empty program object. Programs are deleted with {{apifunc|glDeleteProgram}}.
 
 
 
Once created, program objects must then be filled in with executable code. This is done by [[Shader Compilation|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 {{extref|explicit_attrib_location}} has replaced the need for most of this, by allowing shaders to provide these settings itself.
 
 
 
== Introspection ==
 
{{main|Program Introspection}}
 
 
 
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|pre-link setup]], program objects have the following mutable state:
 
 
 
* The current values of all [[Uniform_(GLSL)#Uniform_management|''active'' uniform variables]].
 
* The current bindings for any [[Interface_Block_(GLSL)#Uniform_blocks|Uniform blocks]].
 
* The current bindings for any [[Interface_Block_(GLSL)#Manual block binding|Shader storage blocks]].
 
 
 
Note that the last two pieces of state only need to be set if you did not [[Interface_Block_(GLSL)#Block_binding|set them directly in the shader]].
 
  
 
[[Category:Shaders]]
 
[[Category:Shaders]]
 
[[Category:OpenGL Shading Language]]
 
[[Category:OpenGL Shading Language]]

Latest revision as of 22:40, 27 December 2014