Advice for drawing smooth curved lines

I’ve been playing around trying to draw some simple curved lines but am struggling to get anything that looks decent – there are always rough looking artefacts. I wonder if anyone has any advice for how to approach this?

Right now I’m using an ofPolyLine and it’s bezierTo() function. I also tried the combo of ofBeginShape(), ofEndShape() and ofCurveVertex() instead but with the same results.

I also tried adding ofEnableSmoothing() but it doesn’t seem to make any difference.

Here are screenshots of the sort of thing I’m seeing with line width set to 6. You can see that the artefacts move as the line is rotated – they don’t seem to relate to where the vertex points are.

I saw a thread somewhere in here that said that the of shape thing had some problems.

maybe you can upscale your curves, and downscale for drawing?

try this addon:

Thanks for the tip! That addon solved my problem and improved a few visual things in general, very nice.

The only thing I’ve run into is that it seems that ofxShivaVG’s requirement to use ‘stencil’ doesn’t play so nicely with ofxPostProcessing which I’m also using. By default ofxPostProcessing seems to disable it but if I get in there and make sure useStencil is enabled then I see weird bounding-box type edges around shapes. Not sure if you’ve come across this? Will do some research into working around it…

I’ve found that I could draw using ofxShiva into an fbo that I setup with these settings (use stencil = true):

ofFbo::Settings settings;
settings.useStencil = true;
settings.height = 768;
settings.width = 1024;
settings.internalformat = GL_RGBA;
settings.numSamples = 2;

maybe you use an fbo like this, draw using ofxshiva, then draw that fbo into a regular fbo you are doing the ofxPostProcessing on?

Thanks for the help guys, drawing into an fbo did indeed solve it.

Here’s a video of what I’ve been playing with – I’m now the master of drawing 2D shapes :wink:

right on looks great!

Bringing back an evergreen, fat lines. What are the suggested addons to work with fat lines at the moment?
It looks like ofxShiva did not receive any update in the last years. I have just tried the example and it does not compile.

Which addons are you using?