WebGLRenderingContext:blendColor() 方法
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
备注: 此特性在 Web Worker 中可用。
WebGL API 的 WebGLRenderingContext.blendColor() 方法用于设置源和目标混合因子。
语法
js
blendColor(red, green, blue, alpha)
参数
返回值
无(undefined)。
示例
要设置混合颜色,请使用:
js
gl.blendColor(0, 0.5, 1, 1);
要获取混合颜色,可以查询 BLEND_COLOR 常量,它会返回一个 Float32Array。
js
gl.getParameter(gl.BLEND_COLOR);
// Float32Array[0, 0.5, 1, 1]
规范
| Specification |
|---|
| WebGL Specification> # 5.14.3> |
浏览器兼容性
Loading…