public static LogObjectInfo ( string message, int handle ) : string | ||
message | string | The info log message string is appended to this string. |
handle | int | The GL object handle that is used to retrieve the info log |
return | string |
public static string LogObjectInfo( string message, int handle )
{
StringBuilder logMessage = new StringBuilder();
if ( handle > 0 )
{
int infologLength = 0;
Gl.glGetObjectParameterivARB( handle, Gl.GL_OBJECT_INFO_LOG_LENGTH_ARB, out infologLength );
if ( infologLength > 0 )
{
int charsWritten = 0;
logMessage.EnsureCapacity( infologLength + 1 );
Gl.glGetInfoLogARB( handle, infologLength, out charsWritten, logMessage );
if ( charsWritten > 0 )
{
logMessage.Append( "\n" );
message += "\n" + logMessage.ToString();
}
LogManager.Instance.Write( message );
}
}
return logMessage.ToString();
}
}
/// <summary> /// Makes a program object active by making sure it is linked and then putting it in use. /// </summary> public void Activate() { if(!linked) { int linkStatus; Gl.glLinkProgramARB(glHandle); Gl.glGetObjectParameterivARB(glHandle, Gl.GL_OBJECT_LINK_STATUS_ARB, out linkStatus); linked = (linkStatus != 0); // force logging and raise exception if not linked GLSLHelper.CheckForGLSLError("Error linking GLSL Program Object", glHandle, !linked, !linked); if(linked) { GLSLHelper.LogObjectInfo("GLSL link result : ", glHandle); BuildUniformReferences(); } } if(linked) { Gl.glUseProgramObjectARB(glHandle); } }