'\" t .\" Title: glLinkProgram .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets v1.79.2 .\" Date: 10/20/2024 .\" Manual: [FIXME: manual] .\" Source: [FIXME: source] .\" Language: English .\" .TH "GLLINKPROGRAM" "3G" "10/20/2024" "[FIXME: source]" "[FIXME: manual]" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" glLinkProgram \- Links a program object .SH "C SPECIFICATION" .HP \w'void\ glLinkProgram('u .BI "void glLinkProgram(GLuint\ " "program" ");" .SH "PARAMETERS" .PP \fIprogram\fR .RS 4 Specifies the handle of the program object to be linked\&. .RE .SH "DESCRIPTION" .PP \fBglLinkProgram\fR links the program object specified by \fIprogram\fR\&. If any shader objects of type \fBGL_VERTEX_SHADER\fR are attached to \fIprogram\fR, they will be used to create an executable that will run on the programmable vertex processor\&. If any shader objects of type \fBGL_GEOMETRY_SHADER\fR are attached to \fIprogram\fR, they will be used to create an executable that will run on the programmable geometry processor\&. If any shader objects of type \fBGL_FRAGMENT_SHADER\fR are attached to \fIprogram\fR, they will be used to create an executable that will run on the programmable fragment processor\&. .PP The status of the link operation will be stored as part of the program object\*(Aqs state\&. This value will be set to \fBGL_TRUE\fR if the program object was linked without errors and is ready for use, and \fBGL_FALSE\fR otherwise\&. It can be queried by calling \fBglGetProgram\fR() with arguments \fIprogram\fR and \fBGL_LINK_STATUS\fR\&. .PP As a result of a successful link operation, all active user\-defined uniform variables belonging to \fIprogram\fR will be initialized to 0, and each of the program object\*(Aqs active uniform variables will be assigned a location that can be queried by calling \fBglGetUniformLocation\fR()\&. Also, any active user\-defined attribute variables that have not been bound to a generic vertex attribute index will be bound to one at this time\&. .PP Linking of a program object can fail for a number of reasons as specified in the \fIOpenGL Shading Language Specification\fR\&. The following lists some of the conditions that will cause a link error\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The number of active attribute variables supported by the implementation has been exceeded\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The storage limit for uniform variables has been exceeded\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The number of active uniform variables supported by the implementation has been exceeded\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The \fBmain\fR function is missing for the vertex, geometry or fragment shader\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A varying variable actually used in the fragment shader is not declared in the same way (or is not declared at all) in the vertex shader, or geometry shader if present\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A reference to a function or variable name is unresolved\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A shared global is declared with two different types or two different initial values\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} One or more of the attached shader objects has not been successfully compiled\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Binding a generic attribute matrix caused some rows of the matrix to fall outside the allowed maximum of \fBGL_MAX_VERTEX_ATTRIBS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Not enough contiguous vertex attribute slots could be found to bind attribute matrices\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The program object contains objects to form a fragment shader but does not contain objects to form a vertex shader\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The program object contains objects to form a geometry shader but does not contain objects to form a vertex shader\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The program object contains objects to form a geometry shader and the input primitive type, output primitive type, or maximum output vertex count is not specified in any compiled geometry shader object\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The program object contains objects to form a geometry shader and the input primitive type, output primitive type, or maximum output vertex count is specified differently in multiple geometry shader objects\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The number of active outputs in the fragment shader is greater than the value of \fBGL_MAX_DRAW_BUFFERS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The program has an active output assigned to a location greater than or equal to the value of \fBGL_MAX_DUAL_SOURCE_DRAW_BUFFERS\fR and has an active output assigned an index greater than or equal to one\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} More than one varying out variable is bound to the same number and index\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The explicit binding assigments do not leave enough space for the linker to automatically assign a location for a varying out array, which requires multiple contiguous locations\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The \fIcount\fR specified by \fBglTransformFeedbackVaryings\fR() is non\-zero, but the program object has no vertex or geometry shader\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Any variable name specified to \fBglTransformFeedbackVaryings\fR() in the \fIvaryings\fR array is not declared as an output in the vertex shader (or the geometry shader, if active)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Any two entries in the \fIvaryings\fR array given \fBglTransformFeedbackVaryings\fR() specify the same varying variable\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The total number of components to capture in any transform feedback varying variable is greater than the constant \fBGL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS\fR and the buffer mode is \fBGL_SEPARATE_ATTRIBS\fR\&. .RE .PP When a program object has been successfully linked, the program object can be made part of current state by calling \fBglUseProgram\fR()\&. Whether or not the link operation was successful, the program object\*(Aqs information log will be overwritten\&. The information log can be retrieved by calling \fBglGetProgramInfoLog\fR()\&. .PP \fBglLinkProgram\fR will also install the generated executables as part of the current rendering state if the link operation was successful and the specified program object is already currently in use as a result of a previous call to \fBglUseProgram\fR()\&. If the program object currently in use is relinked unsuccessfully, its link status will be set to \fBGL_FALSE\fR , but the executables and associated state will remain part of the current state until a subsequent call to \fBglUseProgram\fR removes it from use\&. After it is removed from use, it cannot be made part of current state until it has been successfully relinked\&. .PP If \fIprogram\fR contains shader objects of type \fBGL_VERTEX_SHADER\fR, and optionally of type \fBGL_GEOMETRY_SHADER\fR, but does not contain shader objects of type \fBGL_FRAGMENT_SHADER\fR, the vertex shader executable will be installed on the programmable vertex processor, the geometry shader executable, if present, will be installed on the programmable geometry processor, but no executable will be installed on the fragment processor\&. The results of rasterizing primitives with such a program will be undefined\&. .PP The program object\*(Aqs information log is updated and the program is generated at the time of the link operation\&. After the link operation, applications are free to modify attached shader objects, compile attached shader objects, detach shader objects, delete shader objects, and attach additional shader objects\&. None of these operations affects the information log or the program that is part of the program object\&. .SH "NOTES" .PP If the link operation is unsuccessful, any information about a previous link operation on \fIprogram\fR is lost (i\&.e\&., a failed link does not restore the old state of \fIprogram\fR )\&. Certain information can still be retrieved from \fIprogram\fR even after an unsuccessful link operation\&. See for instance \fBglGetActiveAttrib\fR() and \fBglGetActiveUniform\fR()\&. .SH "ERRORS" .PP \fBGL_INVALID_VALUE\fR is generated if \fIprogram\fR is not a value generated by OpenGL\&. .PP \fBGL_INVALID_OPERATION\fR is generated if \fIprogram\fR is not a program object\&. .PP \fBGL_INVALID_OPERATION\fR is generated if \fIprogram\fR is the currently active program object and transform feedback mode is active\&. .SH "ASSOCIATED GETS" .PP \fBglGet\fR() with the argument \fBGL_CURRENT_PROGRAM\fR .PP \fBglGetActiveAttrib\fR() with argument \fIprogram\fR and the index of an active attribute variable .PP \fBglGetActiveUniform\fR() with argument \fIprogram\fR and the index of an active uniform variable .PP \fBglGetAttachedShaders\fR() with argument \fIprogram\fR .PP \fBglGetAttribLocation\fR() with argument \fIprogram\fR and an attribute variable name .PP \fBglGetProgram\fR() with arguments \fIprogram\fR and \fBGL_LINK_STATUS\fR .PP \fBglGetProgramInfoLog\fR() with argument \fIprogram\fR .PP \fBglGetUniform\fR() with argument \fIprogram\fR and a uniform variable location .PP \fBglGetUniformLocation\fR() with argument \fIprogram\fR and a uniform variable name .PP \fBglIsProgram\fR() .SH "VERSION SUPPORT" .TS allbox tab(:); lB cB s s s s s s s s s s s lB cB cB cB cB cB cB cB cB cB cB cB cB. T{ T}:T{ \fBOpenGL Version\fR T} T{ \fBFunction / Feature Name\fR T}:T{ \fB2\&.0\fR T}:T{ \fB2\&.1\fR T}:T{ \fB3\&.0\fR T}:T{ \fB3\&.1\fR T}:T{ \fB3\&.2\fR T}:T{ \fB3\&.3\fR T}:T{ \fB4\&.0\fR T}:T{ \fB4\&.1\fR T}:T{ \fB4\&.2\fR T}:T{ \fB4\&.3\fR T}:T{ \fB4\&.4\fR T}:T{ \fB4\&.5\fR T} .T& l c c c c c c c c c c c c. T{ \fBglLinkProgram\fR T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T} .TE .sp 1 .SH "SEE ALSO" .PP \fBglAttachShader\fR(), \fBglBindAttribLocation\fR(), \fBglCompileShader\fR(), \fBglCreateProgram\fR(), \fBglDeleteProgram\fR(), \fBglDetachShader\fR(), \fBglUniform\fR(), \fBglUseProgram\fR(), \fBglValidateProgram\fR() .SH "COPYRIGHT" .PP Copyright \(co 2003\-2005 3Dlabs Inc\&. Ltd\&. Copyright \(co 2010\-2014 Khronos Group\&. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1\&.0, 8 June 1999\&. \m[blue]\fBhttps://opencontent\&.org/openpub/\fR\m[]\&. .SH "COPYRIGHT" .br Copyright \(co 2003-2005 3Dlabs Inc. Ltd. .br Copyright \(co 2010-2014 Khronos Group .br