What does ofClearAlpha do and when to use it?

I tried ofClearAlpha but it doesn’t seem to have any effect on my drawing.
I thought it would clear out the alpha blending but maybe it has a different usage?

http://openframeworks.cc/documentation/graphics/ofGraphics/#show_ofClearAlpha

ofClearAlpha() is like ofClear(…) but just for the alpha channel.

a common use would be that you draw transparent items into an fbo but when you go to draw the fbo, those pixels are transparent now so the fbo is blended with the background. I use it to make the fbo opaque again –

fbo.begin()
ofClear(…) // clear the fbo
draw some transparent stuff
ofClearAlpha() // clear the alpha
fbo.end()

now fbo is fully opaque, even if it had some transparent stuff drawn in it…

2 Likes

Thank you @zach :slight_smile: