WebGLProgram CreateShaderProgram(WebGLRenderingContext gl, WebGLShader vertShader, WebGLShader fragShader) { var prog = gl.CreateProgram().As <WebGLProgram>(); gl.AttachShader(prog, vertShader); gl.AttachShader(prog, fragShader); gl.LinkProgram(prog); var status = gl.GetProgramParameter(prog, gl.LINK_STATUS); if (status.As <bool>()) { return(prog); } var info = gl.GetProgramInfoLog(prog); gl.DeleteProgram(prog); throw new InvalidOperationException($"Unable to link program. Details: {info}"); }