WebGLRenderingContext.blendColor()

blendColor用来设置源(source)和目标(destination)的混合因子。

语法

void gl.blendColor(red, green, blue, alpha);

参数

red

一个GLclampf代表红色成分, 在0到1的范围内

green

一个GLclampf代表绿色成分, 在0到1的范围内

blue

一个GLclampf代表蓝色成分, 在0到1的范围内

alpha

一个GLclampf代表透明度, 在0到1的范围内

返回值

例子

设置混合颜色,可使用:

gl.blendColor(0, 0.5, 1, 1);

获得混合颜色信息,询问BLEND-COLOR常数,它会返回一个32位Float类型数组

gl.getParameter(gl.BLEND_COLOR);
// Float32Array[0, 0.5, 1, 1]

规范

WebGL 1.0

OpenGL ES 2.0

浏览器兼容

Desktop:Chrome 9、 Firefox 4.0 、 Internet Explorer 11 、Opera 12、Safari 5.1;

Mobile: Android ?、 Chrome for Android 25、 Firefox Mobile (Yes)、 IE Mobile ?、 Opera Mobile 12、 Safari Mobile 8.1;

results matching ""

    No results matching ""