Specifies how the red, green, blue, and alpha destination blending factors are computed. Specifies how the red, green, blue, and alpha destinationblending factors are computed. Specifies how the red, green, blue, and alpha source blending. For example, i have 2 gl textures, where the alpha is on tex1, i want to have alpha in my final image. Transparency can be achieved by adding the translucent objects color. When more than one color buffer is enabled for drawing, the gl performs blending separately for each enabled buffer, using the contents of that buffer for destination color. Blending in opengl is commonly known as the technique to implement transparency within objects. See glblendfunc or glblendfuncseparate for a description of the various blend factors. This function sets both the rgb blend equation and the alpha blend equation to a single equation. In webgl, constant color and constant alpha cannot be used together as source and destination factors in the blend function.
Due to your comment, you could just render each pass indivually into a texture best done using fbos, using your needed blend function. Alpha is a 4th color component usually specified at the end. The multiply blend mode only supports a grey scale value when using premultiplied alpha. What i do think is that i should use a second glblendfunc which allows to blend the two passes, but i cant think of a way to not touch any of the alpha values, which would destroy the wished effect. This demo program demonstrates using pyopengl via pygame for 2d alpha blended texturesprites specified by a vertex array and the standard sdl api exposed by pygame for sound and keyboard control. Incoming source alpha is correctly thought of as a material opacity, ranging from 1. If you had any issues regarding this video, feel free to comment below and ask. Transparency is all about objects or parts of them not having a solid color, but having a combination of colors from the object itself and any other object behind it with varying intensity. These equations use the source and destination blend factors specified by either glblendfunc or glblendfuncseparate. Function definition void glblendfunc glenum sfactor, glenum dfactor. The dst alpha factor for the fourth argument of glblendfuncseparate. Visual glblendfunc and glblendequation tool anders riggelsen. For glblendfunci, specifies the index of the draw buffer for which to set the blend function.
1182 1236 48 210 167 214 867 1118 774 204 516 88 976 1378 1472 592 814 429 1376 851 505 1448 253 847 1510 1300 435 565 1232 245 1447 1091 1134 1098 293 1140 546 833 1475 563 314 296