--- title: WebGLRenderingContext.getProgramInfoLog() slug: Web/API/WebGLRenderingContext/getProgramInfoLog translation_of: Web/API/WebGLRenderingContext/getProgramInfoLog ---
WebGLRenderingContext.getProgramInfoLog 返回参数中指定的{{domxref("WebGLProgram")}} object 的信息. 这些信息包括在linking过程中的错误以及 WebGLProgram
objects 合法性检查的错误.
gl.getProgramInfoLog(program);
返回 {{domxref("DOMString")}} 包含 diagnostic , warning ...等等关于上一次linking和valiadation操作的信息. 对于刚刚创建的{{domxref("WebGLProgram")}} object , 返回一个空字符串.
var canvas = document.getElementsById('canvas'); var gl = canvas.getContext('webgl'); var program = gl.createProgram(); //vsSource is the source-code-string of vertex-shader //fsSource is the source-code-string of fragment-shader var vertexShader = loadShader(gl, gl.VERTEX_SHADER, vsSource); var fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fsSource); // Attach pre-existing shaders gl.attachShader(program, vertexShader); gl.attachShader(program, fragmentShader); gl.linkProgram(program); gl.getProgramInfoLog(program);
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL', "#5.14.9", "getProgramInfoLog")}} | {{Spec2('WebGL')}} | Initial definition. |
{{SpecName('OpenGL ES 2.0', "glGetProgramInfoLog.xml", "glGetProgramInfoLog")}} | {{Spec2('OpenGL ES 2.0')}} | Man page of the OpenGL API. |
{{Compat("api.WebGLRenderingContext.getProgramInfoLog")}}