2
我正在webGL中工作。我对OpenGL相当陌生。混合功能遇到问题。我的选择是这样的:OpenGL混合呈现灰黑色的黑色?
gl.enable(gl.BLEND)
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
我渲染上的目标的背景颜色[0,0,0,1]
的顶部颜色[0,0,0,0.5]
源矩形。根据我读过的所有内容,我预计结果是黑色的。相反,它看起来约为25%的白色。这是我在渲染red and black rectangles with alpha values ranging from 0.0 to 1.0时得到的结果。
View live demo and source here。我误解了混合功能,如果是这样,我如何得到我所期望的?谢谢!
[在WebGL的HTML背景融合]的可能重复(http://stackoverflow.com/questions/11521035/blending-with-html-background- in-webgl) –
是的,就是这样!它将画布本身设置为透明,呈现背景颜色。我可以通过将画布样式设置为'background:black'来修复它。谢谢! – Cosmologicon