public IEffect Compile(string path)
{
string source = new System.IO.StreamReader(path).ReadToEnd();
int effectHandle = GL.CreateShader(ShaderType.VertexShader); //TODO ShaderType.FragmentShader
GL.ShaderSource(effectHandle, source); //change the source code of the shader behind the handle
GL.CompileShader(effectHandle);
int statusCode;
string info;
GL.GetShaderInfoLog(effectHandle, out info);
GL.GetShader(effectHandle, ShaderParameter.CompileStatus, out statusCode);
if (statusCode != 1)
{
throw new Exception(string.Format("Error while loading shader: {0}, {1}", source, info));
}
this.mProgramHandle = GL.CreateProgram();
GL.AttachShader(mProgramHandle, effectHandle);
GL.LinkProgram(mProgramHandle); //TODO: Just move this into a kind of an EffectBinder like the BufferBinder
GL.UseProgram(mProgramHandle);
return new OpenTKEffect(effectHandle);
}