Shaders & programsGL 2.0

glCreateProgram

Creates an empty program object, which will link shaders into one pipeline.

Part of the family glCreate*

Signature

GLuint glCreateProgram(void);

How it works

A program is the complete set of shaders used together for drawing: at least a vertex and a fragment shader. You attach compiled shaders to it, link it, and then select it with glUseProgram before drawing.

Return value

The new program ID, or 0 on failure.

Example

example.cpp
1GLuint program = glCreateProgram();
2glAttachShader(program, vs);
3glAttachShader(program, fs);
4glLinkProgram(program);
Official Khronos documentation