WebGLRenderingContext.getProgramInfoLog()

翻译正在进行中。

WebGLRenderingContext.getProgramInfoLog  返回参数中指定的WebGLProgram object 的信息. 这些信息包括在linking过程中的错误以及 WebGLProgram objects 合法性检查的错误.

Syntax

gl.getProgramInfoLog(program);

Parameters

program
A WebGLProgram to query.

Return value

返回 DOMString 包含 diagnostic , warning ...等等关于上一次linking和valiadation操作的信息. 对于刚刚创建的WebGLProgram object , 返回一个空字符串.

Examples

Checking program errors

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);

Specifications

Specification Status Comment
WebGL 1.0
getProgramInfoLog
Recommendation Initial definition.
OpenGL ES 2.0
glGetProgramInfoLog
Standard Man page of the OpenGL API.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 12Safari iOS Full support 8.1Samsung Internet Android Full support Yes

Legend

Full support  
Full support

See also

文档标签和贡献者

此页面的贡献者: mdnwebdocs-bot, ihgazni
最后编辑者: mdnwebdocs-bot,