Create a program object
C Specification
GLuint glCreateProgram(void);
Description
glCreateProgram
creates an empty program object and returns a nonzero 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
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 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.
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
Create a shader object
C Specification
GLuint glCreateShader(GLenum shaderType);
Parameters
Description
glCreateShader
creates an empty shader object and returns a nonzero value by which it can be referenced. A shader object is used to maintain the source code strings that define a shader. shaderType
indicates the type of shader to be created. Two types of shaders are supported. A shader of type GL_VERTEX_SHADER
is a shader that is intended to run on the programmable vertex processor and replace the fixed functionality vertex processing in OpenGL. A shader of type GL_FRAGMENT_SHADER
is a shader that is intended to run on the programmable fragment processor and replace the fixed functionality fragment processing in OpenGL.
When created, a shader object’s GL_SHADER_TYPE
parameter is set to either GL_VERTEX_SHADER
or GL_FRAGMENT_SHADER
, depending on the value of shaderType
.
glCreateShader
is available only if the GL version is 2.0 or greater.
Like display lists and texture objects, the name space for shader 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 shader object.
GL_INVALID_ENUM
is generated if shaderType
is not an accepted value.
GL_INVALID_OPERATION
is generated if glCreateShader
is executed between the execution of glBegin
and the corresponding execution of glEnd
.
Associated Gets
glGetShader
with a valid shader object and the parameter to be queried
glGetShaderInfoLog
with a valid shader object
glGetShaderSource
with a valid shader object
glIsShader
See Also
glAttachShader
, glCompileShader
, glDeleteShader
, glDetachShader
, glShaderSource
Specify whether front- or back-facing facets can be culled
C Specification
void glCullFace(GLenum mode);
Parameters
Description
glCullFace
specifies whether front- or back-facing facets are culled (as specified by mode
) when facet culling is enabled. Facet culling is initially disabled. To enable and disable facet culling, call the glEnable
and glDisable
commands with the argument GL_CULL_FACE
. Facets include triangles, quadrilaterals, polygons, and rectangles.
glFrontFace
specifies which of the clockwise and counterclockwise facets are front-facing and back-facing. See glFrontFace
.
Notes
If mode
is GL_FRONT_AND_BACK
, no facets are drawn, but other primitives such as points and lines are drawn.
Errors
GL_INVALID_ENUM
is generated if mode
is not an accepted value.
GL_INVALID_OPERATION
is generated if glCullFace
is executed between the execution of glBegin
and the corresponding execution of glEnd
.
Associated Gets
glIsEnabled
with argument GL_CULL_FACE
glGet
with argument GL_CULL_FACE_MODE
See Also
glEnable
, glFrontFace
C Specification
void glDeleteBuffers(GLsizei n,
const GLuint * buffers);
Parameters
Description
glDeleteBuffers
deletes n
buffer objects named by the elements of the array buffers
. After a buffer object is deleted, it has no contents, and its name is free for reuse (for example by glGenBuffers
). If a buffer object that is currently bound is deleted, the binding reverts to 0 (the absence of any buffer object, which reverts to client memory usage).
glDeleteBuffers
silently ignores 0’s and names that do not correspond to existing buffer objects.
Notes
glDeleteBuffers
is available only if the GL version is 1.5 or greater.
Errors
GL_INVALID_VALUE
is generated if n
is negative.
GL_INVALID_OPERATION
is generated if glDeleteBuffers
is executed between the execution of glBegin
and the corresponding execution of glEnd
.
Associated Gets
glIsBuffer
See Also
glBindBuffer
, glGenBuffers
, glGet
Delete a contiguous group of display lists
C Specification
void glDeleteLists(GLuint list,
GLsizei range);
Parameters
Description
glDeleteLists
causes a contiguous group of display lists to be deleted. list
is the name of the first display list to be deleted, and range
is the number of display lists to delete. All display lists d
with list
<= d
<= list
+ range
– 1 are deleted.
All storage locations allocated to the specified display lists are freed, and the names are available for reuse at a later time. Names within the range that do not have an associated display list are ignored. If range
is 0, nothing happens.
Errors
GL_INVALID_VALUE
is generated if range
is negative.
GL_INVALID_OPERATION
is generated if glDeleteLists
is executed between the execution of glBegin
and the corresponding execution of glEnd
.
See Also
glCallList
, glCallLists
, glGenLists
, glIsList
, glNewList
C Specification
void glDeleteProgram(GLuint program);
Parameters
Description
glDeleteProgram
frees the memory and invalidates the name associated with the program object specified by program
. This command effectively undoes the effects of a call to glCreateProgram
.
If a program object is in use as part of current rendering state, it will be flagged for deletion, but it will not be deleted until it is no longer part of current state for any rendering context. If a program object to be deleted has shader objects attached to it, those shader objects will be automatically detached but not deleted unless they have already been flagged for deletion by a previous call to glDeleteShader
. A value of 0 for program
will be silently ignored.
To determine whether a program object has been flagged for deletion, call glGetProgram
with arguments program
and GL_DELETE_STATUS
.
Notes
glDeleteProgram
is available only if the GL version is 2.0 or greater.
Errors
GL_INVALID_VALUE
is generated if program
is not a value generated by OpenGL.
GL_INVALID_OPERATION
is generated if glDeleteProgram
is executed between the execution of glBegin
and the corresponding execution of glEnd
.
Associated Gets
glGet
with argument GL_CURRENT_PROGRAM
glGetProgram
with arguments program
and GL_DELETE_STATUS
glIsProgram
See Also
glCreateShader
, glDetachShader
, glUseProgram
Delete named query objects
C Specification
void glDeleteQueries(GLsizei n,
const GLuint * ids);
Parameters
Description
glDeleteQueries
deletes n
query objects named by the elements of the array ids
. After a query object is deleted, it has no contents, and its name is free for reuse (for example by glGenQueries
). glDeleteQueries
silently ignores 0’s and names that do not correspond to existing query objects.
Notes
glDeleteQueries
is available only if the GL version is 1.5 or greater.
GL_INVALID_VALUE
is generated if n
is negative.
GL_INVALID_OPERATION
is generated if glDeleteQueries
is executed between the execution of glBeginQuery
and the corresponding execution of glEndQuery
.
GL_INVALID_OPERATION
is generated if glDeleteQueries
is executed between the execution of glBegin
and the corresponding execution of glEnd
.
Associated Gets
glIsQuery
See Also
glBeginQuery
, glEndQuery
, glGenQueries
, glGetQueryiv
, glGetQueryObject
Delete a shader object
C Specification
void glDeleteShader(GLuint shader);
Parameters
Description
glDeleteShader
frees the memory and invalidates the name associated with the shader object specified by shader
. This command effectively undoes the effects of a call to glCreateShader
.
If a shader object to be deleted is attached to a program object, it will be flagged for deletion, but it will not be deleted until it is no longer attached to any program object, for any rendering context (i.e., it must be detached from wherever it was attached before it will be deleted). A value of 0 for shader
will be silently ignored.
To determine whether an object has been flagged for deletion, call glGetShader
with arguments shad
er
and GL_DELETE_STATUS
.
Notes
glDeleteShader
is available only if the GL version is 2.0 or greater.
Errors
GL_INVALID_VALUE
is generated if shader
is not a value generated by OpenGL.
GL_INVALID_OPERATION
is generated if glDeleteShader
is executed between the execution of glBegin
and the corresponding execution of glEnd
.
Associated Gets
glGetAttachedShaders
with the program object to be queried
glGetShader
with arguments shader
and GL_DELETE_STATUS
glIsShader
See Also
glCreateProgram
, glCreateShader
, glDetachShader
, glUseProgram
Delete named textures
C Specification
void glDeleteTextures(GLsizei n,
const GLuint * textures);
Description
glDeleteTextures
deletes n
textures named by the elements of the array textures
. After a texture is deleted, it has no contents or dimensionality, and its name is free for reuse (for example by glGenTextures
). If a texture that is currently bound is deleted, the binding reverts to 0 (the default texture). glDeleteTextures
silently ignores 0’s and names that do not correspond to existing textures.
Notes
glDeleteTextures
is available only if the GL version is 1.1 or greater.
Errors
GL_INVALID_VALUE
is generated if n
is negative.
GL_INVALID_OPERATION
is generated if glDeleteTextures
is executed between the execution of glBegin
and the corresponding execution of glEnd
.
Associated Gets
glIsTexture
See Also
glAreTexturesResident
, glBindTexture
, glCopyTexImage1D
, glCopyTexImage2D
, glGenTextures
, glGet
, glGetTexParameter
, glPrioritizeTextures
, glTexImage1D
, glTexImage2D
, glTexParameter
Specify the value used for depth buffer comparisons
C Specification
void glDepthFunc(GLenum func);
Parameters
Description
glDepthFunc
specifies the function used to compare each incoming pixel depth value with the depth value present in the depth buffer. The comparison is performed only if depth testing is enabled. (See glEnable
and glDisable
of GL_DEPTH_TEST
.)
func
specifies the conditions under which the pixel will be drawn. The comparison functions are as follows:
GL_NEVER
Never passes.
GL_LESS
Passes if the incoming depth value is less than the stored depth value.
GL_EQUAL
Passes if the incoming depth value is equal to the stored depth value.
GL_LEQUAL
Passes if the incoming depth value is less than or equal to the stored depth value.
GL_GREATER
Passes if the incoming depth value is greater than the stored depth value.
GL_NOTEQUAL
Passes if the incoming depth value is not equal to the stored depth value.