WebGLRenderingContext.linkProgram()

这篇翻译不完整。请帮忙从英语翻译这篇文章

WebGL API的WebGLRenderingContext.linkProgram() 方法链接一个给定的WebGLProgram 到已附着的顶点着色器和片段着色器。

语法

void gl.linkProgram(program);

参数

program
一个用于链接的 WebGLProgram

返回值

None.

例子

var program = gl.createProgram();

// Attach pre-existing shaders
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);

gl.linkProgram(program);

if ( !gl.getProgramParameter( program, gl.LINK_STATUS) ) {
  var info = gl.getProgramInfoLog(program);
  throw new Error('Could not compile WebGL program. \n\n' + info);
}

规范

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

浏览器兼容性

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

参考

文档标签和贡献者

此页面的贡献者: yangchengjian
最后编辑者: yangchengjian,