The following table summarizes the WebGL functions that are relevant to performing alpha-blending operations:
WebGL function | Description |
gl.enable|disable(gl.BLEND) | Enable/disable blending. |
gl.blendFunc(sW, dW) |
Specify pixel arithmetic. Accepted values for sW and dW are as follows:
In addition, sW can also be SRC_ALPHA_SATURATE. |
gl.blendFuncSeparate(sW_rgb, dW_rgb, sW_a, dW_a) |
Specify pixel arithmetic for RGB and alpha components separately. |
gl.blendEquation(mode) |
Specify the equation used for both the RGB blend equation and the alpha blend equation. Accepted values for mode are as follows:
|
gl.blendEquationSeparate(modeRGB, modeAlpha) | Set the RGB blend equation and the alpha blend equation separately. |
gl.blendColor(red, green, blue, alpha) | Set the blend color. |
gl.getParameter(name) |
Just like with other WebGL variables, it is possible to query blending parameters using gl.getParameter. Relevant parameters are as follows:
|