Ejemplo n.º 1
0
bool ShaderProgram::Link()
{
	glLinkProgram( id );

    GLint success;
    glGetProgramiv( id, GL_LINK_STATUS, &success );
    bool isValid = ( success == GL_TRUE );
    if( !isValid )
    {
        PrintInfoLog();
		return false;
    }

    // Get active attributes for attribute map creation
    glGetProgramiv( id, GL_ACTIVE_ATTRIBUTES, &numAttributes );
    attrArray = new ShaderAttribute * [ numAttributes ];

    // Get active uniforms for parameter map creation
    glGetProgramiv( id, GL_ACTIVE_UNIFORMS, &numParams );
    uniformsArray = new Uniform * [ numParams ];
    
    RetrieveAttributes();
    RetrieveParameters();
    
    // Bind attributes
    for( int i=0; i<numAttributes; i++ )
        glBindAttribLocation( id, attrArray[i]->location, attrArray[i]->name.c_str() );
    
    // Detach after linking
    for( int i=0; i<shadersArray.size(); i++ )
    {
        DetachShader( shadersArray[i] );
    }
    
    
    return true;
}
Ejemplo n.º 2
0
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader)
{
	CONTEXT_EXEC(DetachShader(program, shader));
}