WebGLRenderingContext.createShader()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

WebGLRenderingContext.createShader() 用于创建一个 WebGLShader 着色器对象,该对象可以使用 WebGLRenderingContext.shaderSource()WebGLRenderingContext.compileShader() 方法配置着色器代码。

语法

WebGLShader gl.createShader(type);

参数

type

参数为gl.VERTEX_SHADERgl.FRAGMENT_SHADER两者中的一个。

示例

详见 WebGLShader 的使用和示例

规范

Specification
WebGL Specification
# 5.14.9

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
createShader

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

其他相关