Alpha blending with ofPath?

In order to get smooth bezier curves, it seems I need to use ofPath, but I don’t see any alpha blending built into ofPath. Am I missing something? Or can someone tell me how to do it in any case?

thanks

This

  
  
void testApp::setup(){  
    path.lineTo( 400, 100);  
    path.lineTo( 400, 400);  
    path.lineTo( 100, 400);  
    path.lineTo( 100, 100);  
    path.close();  
      
    path.setColor(ofColor(255, 255, 0, 10));  
    ofEnableAlphaBlending();  
}  

works for me.

Thanks, joshua, but that really doesn’t work for me in this example:

  
ofPath curve;  
    curve.setColor( ofColor (0, 0, 0, 70) );  
    curve.setCurveResolution(60);  
    curve.moveTo(50, 300);  
    curve.bezierTo( 50, 0, 420, 0, 420, 300);  
    curve.draw();  
    ofEnableAlphaBlending();  
  
	curve.setColor( ofColor (0, 0, 0, 70) );  
    curve.setCurveResolution(60);  
    curve.moveTo(100, 300);  
    curve.bezierTo( 100, 0, 420, 0, 470, 300);  
    curve.draw();  
    ofEnableAlphaBlending();  
  

I’ve got another, related discussion going about this in the forum:

http://forum.openframeworks.cc/t/jagged-lines-in-ofbezier/11916/0

I’m not quite following what you’re trying to accomplish. This is what the following looks like:

  
  
  
void testApp::draw(){  
    ofBackground(255, 255, 255);  
          
    ofPath curve;  
    curve.setColor( ofColor (50, 0, 0, 70) );  
    curve.setCurveResolution(60);  
    curve.moveTo(50, 300);  
    curve.bezierTo( 50, 0, 420, 0, 420, 300);  
    curve.close();  
    curve.draw();  
      
    ofTranslate(mouseX, 0);  
      
    ofPath curve2;  
    curve2.setColor( ofColor (0, 50, 0, 70) );  
    curve2.setCurveResolution(60);  
    curve2.moveTo(100, 300);  
    curve2.bezierTo( 100, 0, 420, 0, 470, 300);  
    curve2.close();  
    curve2.draw();  
}  
  

That seems about right to me. As a word of warning, getting both depth sorting and alpha blending working the way you might expect them to can be a bit tricky because of how OpenGL handles alpha blending internally.

![](http://forum.openframeworks.cc/uploads/default/2782/Screen Shot 2013-02-05 at 5.21.30 PM.png)

It seems I wasn’t getting the blending because I was drawing the same curve over itself. The code you have now works fine for me, though I had to add the enableAlphaBlending (did you have that somewhere else?).

thanks

Yes, I had it in the setup() method as I try not to call those OpenGL methods more often than necessary.