glCreateShaderProgramv

glCreateShaderProgram: man4/glCreateShaderProgram.xml

glCreateShaderProgram creates a program object containing compiled and linked shaders for a single stage specified by type. strings refers to an array of count strings from which to create the shader executables. glCreateShaderProgram is equivalent (assuming no errors are generated) to:

const GLuint shader = glCreateShader(type);
if (shader) {
    glShaderSource(shader, count, strings, NULL);
    glCompileShader(shader);
    const GLuint program = glCreateProgram();
    if (program) {
        GLint compiled = GL_FALSE;
        glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
        glProgramParameteri(program, GL_PROGRAM_SEPARABLE, GL_TRUE);
        if (compiled) {
            glAttachShader(program, shader);
            glLinkProgram(program);
            glDetachShader(program, shader);
        }
        /* append-shader-info-log-to-program-info-log */
    }
    glDeleteShader(shader);
    return program;
} else {
    return 0;
}

The program object created by glCreateShaderProgram has its GL_PROGRAM_SEPARABLE status set to GL_TRUE.

@OpenGL_Version(OGLIntroducedIn.V4P1)
@OpenGL_Extension("GL_ARB_separate_shader_objects")
fn_glCreateShaderProgramv glCreateShaderProgramv;

See Also

glCreateShader, glCreateProgram, glCompileShader, glLinkProgram

Meta