transparency effects

Hello OFers,

Basically I am working on a project where I need to overlay an image I am loading on top of a video. The way I load and put it on top, it works okay, I can give it 50% transparency with no background. The problem is I need some blending effects here, like overlay or multiply just like in photoshop. Now I was wondering if openframeworks guys implemented something along those ways to achieve a similar effect.

I would appreciate any help
ilteris.

Yep you can… Since it’s rendered with OpenGL, you can use the functions from OpenGL to do it. It’s not as easy as in photoshop, but the trick is the function called glBlendFunc()… Take a look here: http://www.opengl.org/resources/faq/technical/transparency.htm and on google…

also, if you poke in ofGraphics you can see that ofEnableAlphaBlending, is essentially

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

but your blend func can be any number of combinations. it can be tricky to find the right one at first, but most of the photoshop layerings can be done with the right combinations:

http://pyopengl.sourceforge.net/documen-…-nc.3G.html

the two parameter relate to what gets mutliplied by the src pixel and what gets multiplied by the detination pixel before they are added.

there are extensions and so on for more complicated blendings, but you can do quite alot with these…

take care
zach

Here’s another link that could be useful:
http://www.modwiki.net/wiki/OpenGL-Blen-…-terials%29

look here:
http://wiki.openframeworks.cc/index.php-…-Frameworks
go down to where it says blending.

Its would be awesome if someone had some time to finish up/update this wiki page. It is very useful to people getting into openGL with oF.

[edit] never mind. I re-read your post and you are looking for blending effects. But I will keep this link up because it is not well documented (it is not up as a link in the main wiki page) and I think it might be useful to someone.

thanks for all the lovely links!