View Full Version : Source and Destination in Blending.

Brian Jones
08-13-2002, 11:54 AM
Hello, I'm not totally clear on what this means. OpenGL Programming Guide says that the source is fragments that are incoming, and that the destination is fragments that have been rasterized, and are in the frame buffer, if I'm not mistaken. Correct me if I'm wrong. Does this mean that, an object, say a triangle, already drawn, would be considered the destination, and any objects drawn after that would be considered the source?

08-13-2002, 12:11 PM
The source contains what you are drawing, the destination contains what has been placed into the framebuffer.

Brian Jones
08-13-2002, 12:24 PM
So what is the framebuffer, or what exactly is IN the framebuffer when I'm drawing?

08-13-2002, 12:34 PM
Maybe an example would help.

Frame buffer now contains the clear color

Frame buffer now contains the color data for the triangle where it was drawn


If triangle2 overlaps the first triangle, the overlapped parts use a formula like so to calculate the color of each overlapping pixel:
finalColor = (src_alpha * src_color) + ((1-src_alpha) * dest_color));

In other words if the second triangle is 1.0, 0.0, 0.0, 0.6 and the color of triangle 1 was 0.0, 1.0, 0.0 you end up with a final color of 0.6, 0.4, 0.0 where they overlap. Where they don't overlap you get a value of 0.6, 0.0, 0.0 if the clear color was 0.0, 0.0, 0.0.

[This message has been edited by Deiussum (edited 08-13-2002).]