WebGL
WebGLRenderingContext.validateProgram() 是一种 WebGL API ,主要是用来验证 WebGLProgram。它在检查 WebGLProgram 程序是否链接成功的同时还会检查其是否能在当前的 WebGL 中使用。
语法
void gl.validateProgram(program);
参数
- program
- : 待验证的 WebGLProgram。
返回值
None.
Examples
var program = gl.createProgram();
// Attach pre-existing shaders
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
gl.validateProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
var info = gl.getProgramInfoLog(program);
throw "不能编译 WebGL 程序。\n\n" + info;
}
gl.useProgram(program);
规范
浏览器兼容性
See also
- WebGLRenderingContext.createProgram()
- WebGLRenderingContext.deleteProgram()
- WebGLRenderingContext.isProgram()
- WebGLRenderingContext.linkProgram()
- WebGLRenderingContext.useProgram()
- WebGLRenderingContext.getProgramParameter()
- WebGLRenderingContext.getProgramInfoLog()
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
