blending filter 예제

blending filter 예제
1332288646.cpp
// Default (no blending) = Cs*1
glBlendFunc(GL_ONE, GL_ZERO)      

// Draw background only = Cd*1
glBlendFunc(GL_ZERO, GL_ONE)      

// Cs*1 + Cd*1
glBlendFunc(GL_ONE, GL_ONE)       

// Alpha blending (back-to-front) = Cs*As + Cd*(1-As)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) 

// Additive blending (brighten the scene) = Cs*As + Cd*1
glBlendFunc(GL_SRC_ALPHA, GL_ONE) 

// Multiplicative blending = Cd*Cs
glBlendFunc(GL_ZERO, GL_SRC_COLOR)

// Invert all the colors = Cs*(1-Cd)
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO)