drawing with max-color on overlap

Hi again,

I am drawing several shapes that all have a different grayscale.

Is it possible that when two shapes overlap that it draws according a max(src, dst) function. So a dark circle overlapping a white square would still show the entire square.

I have tried setting glBlendEquationEXT to GL_MAX_EXT, but no result. Any ideas?

See image for a simplified example, left if how it prints now, it should be like on the right.

Thanx again all.

hey!

ofEnableAlphaBlending(); //this just turns on blending.
glBlendFunc(GL_SRC_COLOR, GL_ONE); //lets blend to 1.0 eg max

that should do it!

:smiley:
theo

Hi Theo, that works fine if the max color is white, but in some cases it is a light gray…

But some messing around at 4am this morning I found that this works (seems i was pretty close)

  
  
	//draw black box  
	ofSetColor(0,0,0);  
	ofRect(0,0,200,200);  
	  
	//set blending functions  
	ofEnableAlphaBlending();  
	glBlendFunc(GL_SRC_COLOR,GL_DST_COLOR);  
	glBlendEquationEXT(GL_MAX_EXT);  
	  
	// middle gray rect  
	ofSetColor(125,125,125);  
	ofRect(0,0,100,100);  
	  
	// light gray circle  
	ofSetColor(200,200,200);  
	ofCircle(100,75,50);  
  
	// dark gray circle  
	ofSetColor(75,75,75, 75);  
	ofCircle(100,100,50);  
  
	// disable blending  
	ofDisableAlphaBlending();  
  

This should draw as if the light gray circle is on top, then the middle gray square and than on the bottom the dark gray one. But they are drawn in a different order.