void glLinkProgram(GLuint program);
The status of the link operation will be stored as part of the program object's state. This value will be set to GL_TRUE if the program object was linked without errors and is ready for use, and GL_FALSE otherwise. It can be queried by calling glGetProgram() with arguments program and GL_LINK_STATUS.
As a result of a successful link operation, all active user-defined uniform variables belonging to program will be initialized to 0, and each of the program object's active uniform variables will be assigned a location that can be queried by calling glGetUniformLocation(). 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.
Linking of a program object can fail for a number of reasons as specified in the OpenGL Shading Language Specification. The following lists some of the conditions that will cause a link error.
When a program object has been successfully linked, the program object can be made part of current state by calling glUseProgram(). Whether or not the link operation was successful, the program object's information log will be overwritten. The information log can be retrieved by calling glGetProgramInfoLog().
glLinkProgram 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 glUseProgram(). If the program object currently in use is relinked unsuccessfully, its link status will be set to GL_FALSE , but the executables and associated state will remain part of the current state until a subsequent call to glUseProgram removes it from use. After it is removed from use, it cannot be made part of current state until it has been successfully relinked.
If program contains shader objects of type GL_VERTEX_SHADER, and optionally of type GL_GEOMETRY_SHADER, but does not contain shader objects of type GL_FRAGMENT_SHADER, 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.
The program object's 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.
GL_INVALID_OPERATION is generated if program is not a program object.
GL_INVALID_OPERATION is generated if program is the currently active program object and transform feedback mode is active.
glGetActiveAttrib() with argument program and the index of an active attribute variable
glGetActiveUniform() with argument program and the index of an active uniform variable
glGetAttachedShaders() with argument program
glGetAttribLocation() with argument program and an attribute variable name
glGetProgram() with arguments program and GL_LINK_STATUS
glGetProgramInfoLog() with argument program
glGetUniform() with argument program and a uniform variable location
glGetUniformLocation() with argument program and a uniform variable name
|Function / Feature Name||2.0||2.1||3.0||3.1||3.2||3.3||4.0||4.1||4.2||4.3||4.4||4.5|
Copyright © 2010-2014 Khronos Group