OpenGL mixed

mixing

OpenGLIt would value of colors in the presence of colors in the buffer area when rendered, a depth value of each segment is placed in the depth buffer. When the depth buffer is closed, a new color to cover the simple presence of the original color value of a color buffer, depth buffer when opened again, a new fragment of colors in only if they are closer than the near clipping plane of the original value It will replace the original color segments.

glEnable(GL_BlEND);
复制代码

Combination of colors

Destination time standard color: color values ​​already stored in the buffer of the source color of the color: the color value of the current as a result of rendering commands into the color buffer zone

When the mixing function is activated, the source and destination colors are mixed combinations of control equations. By default, the mixing equations shown below:

Cf = (Cs * S) + (Cd * D);

Cf :最终计算参数的颜色 
Cs : 源颜色
Cd :目标颜色 
S:源合因子 
D:目标混合因子
复制代码

Mixing factor

Setting the blending factor, we need to use glBlendFunthe function:

glBlendFunc(GLenum S,GLenum D);
S:源混合因⼦
D:目标混合因⼦
复制代码

Table R, G, B, A respectively represent the red, green, blue, alpha. Table subscripts S, D, representing the source, the destination table C represents a constant color (default blacks appear)

Taken logical education

Reproduced in: https: //juejin.im/post/5d05eb3af265da1b6e65a19b

Guess you like

Origin blog.csdn.net/weixin_34212189/article/details/93165705