GLAPI/glCreateProgram: Difference between revisions
m Renaming category: 'API Reference 4' to 'Core API Reference'. |
m Bot: Adding better formatting. |
||
(3 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
== Function Definition == | == Function Definition == | ||
GLuint '''glCreateProgram'''( | GLuint '''glCreateProgram'''({{param|void}}); | ||
== Description == | == Description == | ||
Line 14: | Line 14: | ||
'''glCreateProgram''' creates an empty program object and returns a non-zero value by which it can be referenced. A program object is an object to which shader objects can be attached. This provides a mechanism to specify the shader objects that will be linked to create a program. It also provides a means for checking the compatibility of the shaders that will be used to create a program (for instance, checking the compatibility between a vertex shader and a fragment shader). When no longer needed as part of a program object, shader objects can be detached. | '''glCreateProgram''' creates an empty program object and returns a non-zero value by which it can be referenced. A program object is an object to which shader objects can be attached. This provides a mechanism to specify the shader objects that will be linked to create a program. It also provides a means for checking the compatibility of the shaders that will be used to create a program (for instance, checking the compatibility between a vertex shader and a fragment shader). When no longer needed as part of a program object, shader objects can be detached. | ||
One or more executables are created in a program object by successfully attaching shader objects to it with | One or more executables are created in a program object by successfully attaching shader objects to it with {{apifunc|glAttachShader}}, successfully compiling the shader objects with {{apifunc|glCompileShader}}, and successfully linking the program object with {{apifunc|glLinkProgram}}. These executables are made part of current state when {{apifunc|glUseProgram}} is called. Program objects can be deleted by calling {{apifunc|glDeleteProgram}}. The memory associated with the program object will be deleted when it is no longer part of current rendering state for any context. | ||
== Notes == | == Notes == | ||
Line 28: | Line 28: | ||
== Associated Gets == | == Associated Gets == | ||
{{apifunc|glGet}} with the argument {{enum|GL_CURRENT_PROGRAM}} | |||
{{apifunc|glGetActiveAttrib}} with a valid program object and the index of an active attribute variable | |||
{{apifunc|glGetActiveUniform}} with a valid program object and the index of an active uniform variable | |||
{{apifunc|glGetAttachedShaders}} with a valid program object | |||
{{apifunc|glGetAttribLocation}} with a valid program object and the name of an attribute variable | |||
{{apifunc|glGetProgram}} with a valid program object and the parameter to be queried | |||
{{apifunc|glGetProgramInfoLog}} with a valid program object | |||
{{apifunc|glGetUniform}} with a valid program object and the location of a uniform variable | |||
{{apifunc|glGetUniformLocation}} with a valid program object and the name of a uniform variable | |||
{{apifunc|glIsProgram}} | |||
== See Also == | == See Also == | ||
{{apifunc|glAttachShader}}, {{apifunc|glBindAttribLocation}}, {{apifunc|glBindFragDataLocation}}, {{apifunc|glBindFragDataLocationIndexed}}, {{apifunc|glCreateShader}}, {{apifunc|glDetachShader}}, {{apifunc|glIsProgram}}, {{apifunc|glLinkProgram}}, {{apifunc|glUniform}}, {{apifunc|glUseProgram}}, {{apifunc|glUseProgramStages}}, {{apifunc|glValidateProgram}}, {{apifunc|glProgramParameter}} | |||
== Copyright == | == Copyright == | ||
Line 56: | Line 56: | ||
Copyright © 2003-2005 3Dlabs Inc. Ltd. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. [http://opencontent.org/openpub/ http://opencontent.org/openpub/]. | Copyright © 2003-2005 3Dlabs Inc. Ltd. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. [http://opencontent.org/openpub/ http://opencontent.org/openpub/]. | ||
[[Category:Core API Reference|CreateProgram]] | [[Category:Core API Reference|CreateProgram]] | ||
[[Category:Core API Ref Shader Program Creation|CreateProgram]] |
Latest revision as of 19:32, 27 September 2012
Core in version | 4.6 | |
---|---|---|
Core since version | 2.0 |
glCreateProgram: Creates a program object
Function Definition
GLuint glCreateProgram(void);
Description
glCreateProgram creates an empty program object and returns a non-zero value by which it can be referenced. A program object is an object to which shader objects can be attached. This provides a mechanism to specify the shader objects that will be linked to create a program. It also provides a means for checking the compatibility of the shaders that will be used to create a program (for instance, checking the compatibility between a vertex shader and a fragment shader). When no longer needed as part of a program object, shader objects can be detached.
One or more executables are created in a program object by successfully attaching shader objects to it with glAttachShader, successfully compiling the shader objects with glCompileShader, and successfully linking the program object with glLinkProgram. These executables are made part of current state when glUseProgram is called. Program objects can be deleted by calling glDeleteProgram. The memory associated with the program object will be deleted when it is no longer part of current rendering state for any context.
Notes
Like buffer and texture objects, the name space for program objects may be shared across a set of contexts, as long as the server sides of the contexts share the same address space. If the name space is shared across contexts, any attached objects and the data associated with those attached objects are shared as well.
Applications are responsible for providing the synchronization across API calls when objects are accessed from different execution threads.
Errors
This function returns 0 if an error occurs creating the program object.
Associated Gets
glGet with the argument GL_CURRENT_PROGRAM
glGetActiveAttrib with a valid program object and the index of an active attribute variable
glGetActiveUniform with a valid program object and the index of an active uniform variable
glGetAttachedShaders with a valid program object
glGetAttribLocation with a valid program object and the name of an attribute variable
glGetProgram with a valid program object and the parameter to be queried
glGetProgramInfoLog with a valid program object
glGetUniform with a valid program object and the location of a uniform variable
glGetUniformLocation with a valid program object and the name of a uniform variable
See Also
glAttachShader, glBindAttribLocation, glBindFragDataLocation, glBindFragDataLocationIndexed, glCreateShader, glDetachShader, glIsProgram, glLinkProgram, glUniform, glUseProgram, glUseProgramStages, glValidateProgram, glProgramParameter
Copyright
Copyright © 2003-2005 3Dlabs Inc. Ltd. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.