Layer effects like in photoshop? [solved]

Hey

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?

Thanks

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

The following might be useful:

http://www.machwerx.com/2009/02/11/glblendfunc/

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’ :

  
ofEnableAlphaBlending();  
  
    glEnable (GL_BLEND);  
    glBlendFunc (GL_DST_COLOR, GL_SRC_ALPHA); // like Photoshop's 'Overlay' blending mode  
    ofSetColor(0xFFFFFF);  
    _image.draw(currentX,0);  
    ofDisableAlphaBlending();  
  

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 ( http://www.andersriggelsen.dk/OpenGL/ )
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.

glBlendEquation(GL_FUNC_ADD);
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);
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
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);
ofSetColor(255,255,255,255);

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