glAttachShader Function

Syntax

GL_APICALL void GL_APIENTRY glAttachShader(
     GLuint program,
     GLuint shader
);

Arguments

Name Description
in program Program object
in shader Shader object

Return Values

No values are returned.

Description

Attaches a shader object to a program object.

Set program to a program object and shader to a shader object. You can attach three types of shaders to a single program: vertex shader objects generated by glCreateShader, geometry shader objects generated by glCreateShader, and the reserved fragment shader GL_DMP_FRAGMENT_SHADER_DMP.

To use a program object, you must at least attach a vertex shader object and the reserved fragment shader.

This function generates the following errors.

GL_INVALID_VALUEThe program argument is a nonexistent program object or shader is a nonexistent shader object.
GL_INVALID_OPERATIONThe shader argument, or another shader object of the same type, is already attached to program.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL