private WebGLShader LoadShader(WebGLContext gl, ShaderType type, string source) { var shader = gl.CreateShader(type); gl.ShaderSource(shader, source); gl.CompileShader(shader); if (!gl.GetShaderParameter <bool>(shader, ShaderParameter.COMPILE_STATUS)) { string info = gl.GetShaderInfoLog(shader); gl.DeleteShader(shader); throw new Exception("An error occured while compiling the shader: " + info); } return(shader); }