![]() | ProgramLink Method |
Namespace: Ooogles
Exception | Condition |
---|---|
ShaderException | When the shaders cannot be linked. |
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 can be accessed using Uniform. 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 ES Shading Language Specification. This will result in a ShaderException (in Debug builds). 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 Use.
This method 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 Use. If the program object currently in use is relinked unsuccessfully, its link status will be set to False, but the executables and associated state will remain part of the current state until a subsequent call to Use removes it from use. After it is removed from use, it cannot be made part of current state until it has been successfully relinked.
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.
Note: if the link operation is unsuccessful, any information about a previous link operation on program is lost (i.e., a failed link does not restore the old state of program). Certain information can still be retrieved from program even after an unsuccessful link operation.
OpenGL API: glLinkProgram, glGetProgramInfoLog, glGetProgramiv(GL_LINK_STATUS/GL_INFO_LOG_LENGTH)