JavaScript EditorFree JavaScript Editor     Ajax Editor 



Main Page
Previous Page
Next Page

glCreateProgram

Name

glCreateProgram Creates a program object

C Specification

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 these actions: successfully attaching shader objects to the program object 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 with glDeleteProgram. The memory associated with the program object is deleted when it is no longer part of current rendering state for any context.

Notes

glCreateProgram is available only if the GL version is 2.0 or greater.

Like display lists 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 synchronizing across API calls when objects are accessed from different execution threads.

Errors

This function returns 0 if an error occurs creating the program object.

GL_INVALID_OPERATION is generated if glCreateProgram is executed between the execution of glBegin and the corresponding execution of glEnd.

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

glIsProgram

See Also

glAttachShader, glBindAttribLocation, glCreateShader, glDeleteProgram, glDetachShader, glLinkProgram, glUniform, glUseProgram, glValidateProgram


Previous Page
Next Page




JavaScript EditorAjax Editor     JavaScript Editor