Created
May 25, 2016 19:00
-
-
Save HalfdanJ/ecabb757e72092c698a5b90c8622fc27 to your computer and use it in GitHub Desktop.
ofFbo with premultiplied alpha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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