Any excuse will serve a tyrant Concept 1.4 : A Simple Example ============================== Idea ==== Two rectangles are drawn on the screen to your left. One is a yellow rectangle, and the other one is colored cyan. By default the following happens : A yellow triangle is drawn first with an alpha value of 1.0. Next the cyan triangle is drawn with an initial alpha value of 1.0 and obscures part of the yellow triangle. Click on the rendering window and select the menu options to change the alpha values for the cyan triangle. The source and destination (Yellow triangle on a Black Background): =============================================== Initially the source is the yellow triangle and the destination is the black background. Here Color components are glColor3f(1, 1, 0, 1) and blend factor GL_ONE is (1, 1, 1, 1) - (Concept 1.2) Multiplying color components and blend factor we get : (RsSr, GsSg, BsSb) = (1*1, 1*1, 0*1, 1*1) = (1, 1, 0, 1) Hence the yellow triangle gets rendered and it obscures the black background since alpha value is 1. Rendering the Cyan Triangle =========================== Here the source is the Cyan triangle. The destination is part yellow (yellow triangle just rendered) and part black (background). Using similar calculations we get glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.0, 1.0, 1.0, alpha_factor); where GL_SRC_ALPHA = (As, As, As, As) and GL_ONE_MINUS_SRC_ALPHA = (1, 1, 1, 1)-(As, As, As, As) {From Concept 1.2} Initially As = 1 (default value for cyan triangle) Multiplying by the color components we get (0.0, 1.0, 1.0, 1.0) * ( 1, 1, 1, 1) = (0, 1, 1, 1) Now take a look at the destination. Consider the areas of the screen which have their pixels turned to a yellow color. These areas have a glColor4f() value of (1.0, 1.0, 0.0, 1.0) The blend factor in this case is GL_ONE_MINUS_SRC_ ALPHA i.e. (1,1,1,1)-(As,As,As,As) i.e. (1-1, 1-1, 1-1, 1-1) This is equal to (0, 0, 0, 0) The color components are (1, 1, 0, 1). Multiplying we get (1, 1, 0, 1) * (0, 0, 0, 0) = (0 ,0 ,0 ,0) Adding up the source and destination factors where the cyan and yellow triangles overlap leads to the following : (0, 1, 1, 1) + (0, 0, 0, 0) = (0.0, 1.0, 1.0, 1.0). Now the cyan triangle is rendered with the above components which account for a cyan color and an alpha value of 1.0 i.e. total opacity. Therefore where the cyan triangle overlaps the yellow only the cyan is visible. A similar justification can be provided for where the cyan overlaps the black background. It is obvious that changing alpha values for the cyan triangle changes the final computed value and hence we see different degrees of translucency.