将 gl.blendFunc/gl.blendEquation 参数转换为 gl.blendFuncSeparate/gl.blendEquationSeparate
Converting gl.blendFunc/gl.blendEquation arguments into gl.blendFuncSeparate/gl.blendEquationSeparate
gl.blendFunc(A,B)
与 gl.blendFuncSeparate(A,B,A,B)
或 gl.blendFuncSeparate(A,B,ONE,ZERO)
相同吗?
gl.blendEquation(A)
与 gl.blendEquation(A,A)
或 gl.blendEquation(A,FUNC_ADD)
相同吗?
是否有任何关于此参数转换的文档?
This function sets both the RGB blend equation and the alpha blend equation to a single equation.
Each method defines four scale factors, one each for red, green, blue, and alpha.
因此,第一个选项:gl.blendFunc(A, B)
与 gl.blendFuncSeparate(A, B, A, B)
相同。
gl.blendFunc(A,B)
正好等于
gl.blendFunc(A,B,A,B)
来自 https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/blendFuncSeparate
上的函数页面
我们可以看到函数的语法
void gl.blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
如果您将这些参数视为要与相应参数名称相乘的常量,这会有所帮助,例如
gl.blendFuncSeparate(SRC_ALPHA, //sourcRGB will be multiplied by SRC_ALPHA
ONE_MINUS_SRC_ALPHA, //destinationRGB will be multiplied by ONE_MINUS_SRC_ALPHA
SRC_ALPHA, //sourceALPHA will be multiplied by SRC_ALPHA
ONE_MINUS_SRC_ALPHA); //destinationALPHA will be multiplied by ONE_MINUS_SRC_ALPHA
这同样适用于 gl.blendEquation() 和 blendEquationSeparate(),您可以在其中为 RGB 颜色和 alpha 值指定不同的方程式,默认情况下 gl.blendEquation 相同的方程式应用于两者rgb 和 alpha 值。
要更好地了解整个 opengl 混合系统的工作原理,请查看来自 andersriggelsen.dk 的精彩网页
http://andersriggelsen.dk/glblendfunc.php
gl.blendFunc(A,B)
与 gl.blendFuncSeparate(A,B,A,B)
或 gl.blendFuncSeparate(A,B,ONE,ZERO)
相同吗?
gl.blendEquation(A)
与 gl.blendEquation(A,A)
或 gl.blendEquation(A,FUNC_ADD)
相同吗?
是否有任何关于此参数转换的文档?
This function sets both the RGB blend equation and the alpha blend equation to a single equation.
Each method defines four scale factors, one each for red, green, blue, and alpha.
因此,第一个选项:gl.blendFunc(A, B)
与 gl.blendFuncSeparate(A, B, A, B)
相同。
gl.blendFunc(A,B)
正好等于
gl.blendFunc(A,B,A,B)
来自 https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/blendFuncSeparate
上的函数页面我们可以看到函数的语法
void gl.blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
如果您将这些参数视为要与相应参数名称相乘的常量,这会有所帮助,例如
gl.blendFuncSeparate(SRC_ALPHA, //sourcRGB will be multiplied by SRC_ALPHA
ONE_MINUS_SRC_ALPHA, //destinationRGB will be multiplied by ONE_MINUS_SRC_ALPHA
SRC_ALPHA, //sourceALPHA will be multiplied by SRC_ALPHA
ONE_MINUS_SRC_ALPHA); //destinationALPHA will be multiplied by ONE_MINUS_SRC_ALPHA
这同样适用于 gl.blendEquation() 和 blendEquationSeparate(),您可以在其中为 RGB 颜色和 alpha 值指定不同的方程式,默认情况下 gl.blendEquation 相同的方程式应用于两者rgb 和 alpha 值。
要更好地了解整个 opengl 混合系统的工作原理,请查看来自 andersriggelsen.dk 的精彩网页 http://andersriggelsen.dk/glblendfunc.php