/// <summary>
/// Makes a program object active by making sure it is linked and then putting it in use.
/// </summary>
public void Activate()
{
if (!this.linked && !this.triedToLinkAndFailed)
{
Gl.glGetError(); //Clean up the error. Otherwise will flood log.
this.glHandle = Gl.glCreateProgramObjectARB();
GLSLHelper.CheckForGLSLError("Error Creating GLSL Program Object", 0);
// TODO: support microcode caching
//if (GpuProgramManager.Instance.CanGetCompiledShaderBuffer() &&
// GpuProgramManager.Instance.IsMicrocodeAvailableInCache(CombinedName))
if (false)
{
GetMicrocodeFromCache();
}
else
{
CompileAndLink();
}
BuildUniformReferences();
ExtractAttributes();
}
if (this.linked)
{
GLSLHelper.CheckForGLSLError("Error prior to using GLSL Program Object : ", this.glHandle, false, false);
Gl.glUseProgramObjectARB(this.glHandle);
GLSLHelper.CheckForGLSLError("Error using GLSL Program Object : ", this.glHandle, false, false);
}
}