Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ofFbo with premultiplied alpha
// Kudos to armadilly
fbo.begin();
{
///pre-multiply background color of the fbo for correct blending!
ofClear(ofColor(fboBgColor * (fboBgColor.a / 255.) , fboBgColor.a));
//Set this blending mode for anything you draw INSIDE the fbo
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
//your draw code here!
}
fbo.end();
//then draw the fbo to your screen buffer with this blending
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
fbo.draw(0,0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.