Layer effects like in photoshop? [solved]


Am wondering how if there is an easy way in which to replicate the layar effects like in photoshop. Some addon im not aware of?

For example, having a dark background layar then a white png gradient above it which can be set to ‘add’

Or is the only current method, looping through each pixel of the image and modifying them directly?


You might want to look into the OpenGL glBlendFunc();

The following might be useful:

I’ve played with glBlendFunc() to make blend modes, and only managed to get a few working, here’s an example that looks like ‘Overlay’ :

    glEnable (GL_BLEND);  
    glBlendFunc (GL_DST_COLOR, GL_SRC_ALPHA); // like Photoshop's 'Overlay' blending mode  

It should be possible with shaders, but I haven’t managed to get a shader working with more than one input image, would be very interested in seeing an example of that.

Thanks for the point in the right direction nikolaspsaroudakis!

Robotfunk, ive also found this site quite helpful ( )
Helps cut down on, change -> recompile -> wait… no… etc :wink:

And the open gl blue book, for its more indepth reading.

I was particularly hoping for something similar to photoshops ‘screen’.
Where by i could have a static background (darkish) and have a movie (with a black background and white circles in it) [as i found rendering movie’s with an alpha channel = huge file size] play on top.

This code seems to work.

glBlendFunc(GL_SRC_COLOR, GL_ONE);

movieTexture.draw(20, 625);
specialEvent.draw(20, 625); // This is ‘screened’ on top


Also am using

movieTexture.draw(20, 625);
textureAlpha.draw(20, 765);

which makes a png alpha channel a ‘mask layer’.


Although does anyone know of a good way to reset everything?

Ive been using…
glBlendFunc(GL_ONE, GL_ONE);

But maybe there is a cleaner way?
Was hoping disabling Alpha blending would reset it.