Simple blend mode question

ofImage img1;
img1.load("postit0.png");
ofImage img2;
img2.load("postit4.png");    

img1.draw(0,0); 
ofEnableBlendMode(OF_BLENDMODE_ADD);  
img2.draw(100,100);
ofDisableBlendMode(); 

This should blend the two images, right? I’ve been pouring through forum questions like this and haven’t come across anything that has worked. I feel like I’m misunderstanding something fundamental here. I use blending in lots of other applications, can’t seem to get it with OF. Alpha blending is enabled, have tried it disabled, too.

I’ve also tried adding some things such as img2.setImageType(OF_IMAGE_COLOR_ALPHA);
in case the blend was only being applied to the alpha channel for some reason. Still stuck.

can you post your images and results ?

also if you are just trying to mix the images you can do:

ofEnableAlphaBlending();
ofSetColor(255,255,255);
img1.draw();
ofSetColor(255,255,255,127); // half transparent
img2.draw();

OF_BLENDMODE_ADD is going to blend towards the brightest pixels – ie, it heads towards white, I’m not sure if it’s what you want…


my goal is actually to multiply, but I figured I’d simplify and try to get ADD working for starters since clearly I’m not getting something.

eventually, text will be written on the post-its. The post-its will have wrinkles and stuff (HD photos of real post-its). So I want the text to multiply that to make it look a bit more realistic. it’ll be cool & a huge public outdoor projection in brooklyn that everyone should come check out :wink: just hitting a snag on blending.

anyone wanna throw me a life raft? Should be super straight forward no?

i get this:

with your code, exactly with:

class ofApp: public ofBaseApp
{
		ofImage img1;
		ofImage img2;
public:
	void setup(){
		ofSetBackgroundColor(0);
		img1.load("img1.png");
		img2.load("img2.png");
	}

	void draw(){

		ofEnableBlendMode(OF_BLENDMODE_ADD);
		img1.draw(0,0);
		img2.draw(100,100);
		ofDisableBlendMode();
	}

	void keyPressed(int key){
	}
};

int main()
{
	ofWindowSettings settings;
	ofCreateWindow(settings);
	ofRunApp(new ofApp);
}

which is how it’s supposed to look with additive blending

Oh wow. I found the offending line after going one by one:
ofEnableSmoothing();
For some reason makes blending not function at all. Probably a good reason, whoops.