Circles with outlines and Alphablending

I am am not sure if thats a bug or if I am doing something wrong.

If I draw a circle with its outline like this with alphaBlending activated I only get the filled part blended while the outlines dont blend in at all:

  
ofSetColor(r,g,b);  
ofNoFill();  
ofEllipse(x,y, 100, 100);  
ofFill();  
ofEllipse(x,y, 100, 100);  

I’m not sure what kind of blending you’d be seeing there - since there is not alpha in the ofSetColor… can you post the whole code, and / or a screenshot showing the problem?

my first guess is that you are seeing blending, but that with the circle and outline on the same edge pixels, you are getting that color alot stronger. for example, if you have transparency to 50 %, the pixels of the filled circle are added 50% of them and 50% of underlying. on the edges, the filled circles are done first (ie, 50%/50%), and then, again, when you do the outline, 50% of the outline and 50% of the underlying pixel. basically, you’d have 75% of the color you’d like to blend, as opposed to 50…

anyway, that’s just a guess before my morning coffee :slight_smile:

thanks!!
zach
zach

well, I use additive blending but I think you are right. the outline is "inside the fill thats why it blends in alot stronger. So the mainquestion is: How can I get the outline to be outside the fill. I tried something like:

ofEllipse(x,y, radius+2, radius+2);

for the outline but thats just not accurate at all.

Anyways here is a screen:

all ellipses have an alpha value of 100.
I activate alpha blending and glBlendFunc(GL_SRC_COLOR, GL_ONE); in the setup function of testApp. then I simply draw the circles as I said before.

ah, I see –

I’m not sure this is going to work, but the more accurate version of your idea is:

  
  
ofEllipse(x-1,y-1, radius+2, radius+2);   
  

which will offset by -1,-1 and make it two pixels bigger.

can you let me know if that helps?

  • zach

no. as far as I can tell the ellipses draw from the center.

Now if I increase the radius of the ellipse I can again see the edgy aliased edges of the filled shape. There is propably no way out right now since I just wanted to use the outlines for AA reasons. I am looking forward to a polygon AA implementation.

EDIT:
now that I look at the image again I almost think the additive blending does not affect the outlines at all since if I only draw the outlines they simply overlap. Could that be?