Hello forum,
All you have hopefully gone through the fbo alpha masking example that comes along with the OF. i am finding it hard to understand and some explanation from your end will be of great help.
Initially the following image are loaded
1.backgroundImage = A.jpg (zebra image)
2.foregroundImage = B.jpg (colored zig-zag image)
3.brushImage = brush.png (checkered image)
then fbo and maskFbo both are cleared to the black with alpha component 255.
Now analyze 2 scenarios here.
-
When the mouse is not pressed
-
When the mouse is pressed and dragged.
-
Mouse is not pressed - backgroundImage will go through the shader along with the contents of the maskFbo. Since the mouse is not pressed , maskFbo will only contain the alpha component in its attached texture. Eventually the output color will be the backgroundImage (zebra image) rendered to the fbo. fbo and shader will be detached. Then the foregroundImage(colored zig-zag image) will be rendered to the default frame buffer. At last the contents of the fbo attached texture(zebra image) will be rendered to the default screen. Does it not mean that the zebra image will be drawn on top of the colored zig-zag image. But it is happening the reverse. I must be missing something in my analysis.
Some thoughts and explanations ?
I hope that the second scenario will be easy to understand once i get some explanation here.
Thanks