EN
Este contenido no se encuentra disponible en su idioma, pero aquí tiene la versión en inglés.

blendFunc method

Sets the blending factors used to combine source and destination pixels.

IE11

 

Syntax

WebGLRenderingContext.blendFunc(sfactor, dfactor);

Parameters

sfactor [in]

Type: Number

A multiplier for the source color. See below.

dfactor [in]

Type: Number

A multiplier for destination color. See below.

Return value

This method does not return a value.

Remarks

The blending function is calculated like this: color(RGBA) = ((source color) * sfactor) + ((destination color) * dfactor). Values of colors are between 0 and 1 for each RGB value. Alpha values are between 1 (fully opaque) and 0 (fully transparent).

ConstantFactorDescription
gl.ZERO0 0 0 0Multiply by all colors by 0.
gl.ONE1 1 1 1Multiplies all colors by 1.
gl.SRC_COLORRs Gs Bs AsMultiply by source color value.
gl.ONE_MINUS_SRC_COLOR(1-Rs) (1-Gs) (1-Bs) (1-As)Multiply by 1 minus each color value.
gl.DST_COLORRd Gd Bd AdMultiply by destination color value.
gl.ONE_MINUS_DST_COLOR(1-Rd) (1-Gd) (1-Bd) (1-Ad)Multiply by 1 minus each color value.
gl.SRC_ALPHAAs As As AsMultiply all colors by source alpha value.
gl.ONE_MINUS_SRC_ALPHA(1-As) (1-As) (1-As) (1-As)Multiply all colors by 1 minus source alpha value.
gl.DST_ALPHAAd Ad Ad AdMultiply all colors by source alpha value.
gl.ONE_MINUS_DST_ALPHA(1-Ad) (1-Ad) (1-Ad) (1-Ad)Multiply all colors by 1 minus destination alpha value.
gl.SRC_ALPHA_SATURATEmin(As, Ad) min(As,Ad) min(As,Ad) 1Multiply by the smaller of either source or destination alpha value.

 

WebGL errorDescription
gl.INVALID_ENUMIf the sfactor or the dfactor isn't one of the listed values.

 

See also

WebGLRenderingContext

 

 

Mostrar:
© 2014 Microsoft