Neat circle strokes

hi all,

I’m trying to do some draws in openframeworks, But i can’t get neat/smoothed graphics especially in the strokes
I’m already using:


With this the graphics are better but not as good as i want. Please see the PRINTSCREEN in the attachment.
So, how can i get better super smoothed graphics?

many Thanks

![]( Shot 2013-07-21 at 12.57.37 PM.png)

As far, as i know, ofEnableSmoothing() has no effect on circles.

ofAuckland posted something on how to solve this issue, but i am not sure if it (still) works.
See the example here:

You may could report back after trying this solution.

hi me,
Thanks for the quick answer…

i’ve tried ofAuckland solution, but i can’t notice the difference. Do you know another way to do this?

#include "ofMain.h"  
#include "testApp.h"  
#include "ofAppGlutWindow.h"  
int main( ){  
    ofAppGlutWindow window;  
    window.setGlutDisplayString("rgba double samples>=4");  
    ofSetupOpenGL(&window, 1024,768, OF_WINDOW);  
    ofRunApp( new testApp());  

many thanks


yes there is really one thing I just thought of:
Maybe i am wrong, but it looks like you’re drawing the filling of the circles after you draw the outlines. Drawing it the other way around drastically improves the quality of the circles.

Try it in this order:

    ofCircle( x, y, 250 );  
    ofSetColor(0, 50+color, 20);  
    ofCircle( x, y, 250 );  

Insted of

    ofSetColor(0, 50+color, 20);  
    ofCircle( x, y, 250 );  
    ofCircle( x, y, 250 );  

You can see the difference at the attached images.

Hey me,

Yeah it’s much better, but it still not the quality i was looking for :frowning: it must be some other way to smooth the strokes from the circles…



some ideas

  • antialiasing: try window.setGlutDisplayString(“rgba double samples>=4”); in main.cpp
  • blur it a bit: with ofxBlur
  • use Textures: scale between different sizes
  • use ofxFatLines: nice antialiased lines withe VaseRenderer
  • try cairo

greetings ascorbin

1 Like

This seems not to create different results (see above).


Have you tried ofSetCircleResolution(int res) ?

Hi maximillion,

Yes i did :$, it does make the resolution(number of points on the circle) better, but does not smooth the strokes. :frowning:


Hi guys,

I’m doing a exercise here playing with circles but I’m having some issues withe the resolution of the circles. These are simple ofDrawCircle() with ofNoFill(), nothing else. On the example I tried to increase the thickness of the stroke to show you guys what is happening. Basically I always have a a “broken” circle showing those 4 gaps around.

I already tried many different things like ofSetCircleResolution, window.setGlutDisplayString, ofSetCircleResolution, etc but nothing seems to work.

I could you help me with that? Any thoughts?
I’d like to achieve pixel perfect graphics on my OF sketches and experiments.

Thanks! :slight_smile:

Hi there!

Using ofNoFill() and ofSetLineWidth() usually doesn’t get you nice results. If think ofSetLineWidth() uses an old openGL implementation.

There are better ways to play with line-widths. For exemple, if you want to draw circles, you can quickly combine arc and arcNegative from an ofPath.

Please get an example from here, that I’ve previously provided.

yes something like:

ofPath circle;

circle.arc(x,y,radius - lineWidth, 0,360);


should give you a nice circle

the first arc, draws a filled circle and the second “cuts a hole” in it to leave a contour of lineWidth width.

Thanks a lot guys, I’m gonna have a try here and come back to you showing the results.

Solved! I just modified the central circle to still have the other ones to compare with. Check the difference.
For the central one, instead of using a normal circle, I use the suggested method of combining two arcs.

// .h
ofPath circle;

circle.arc( 0, 0, radiusCircle, radiusCircle, 0, 360);
circle.arc( 0, 0, radiusCircle - lineWidth, radiusCircle - lineWidth, 0, 360);


Thanks for your help, cheers!

1 Like

When I use this code, the circle is flickering.

I just changed from “ofDrawCircle()” to that code. :frowning:

What is difference?

can you post a small example that shows the flickering behaviour? it’s hard to know what might be going on without seeing an example

This link is movie clip how my code is working.

I changed my code from this part

ofDrawCircle(location.x, location.y, 50);
ofSetColor(0, 0, 0);
ofDrawCircle(location.x, location.y, 50);

to this. (I changed position for circle just to make code simple)

circle.arc( 300, 300, 100, 100, 0, 360);
circle.arc( 300, 300, 100 - 10, 100 - 10, 0, 360);


Maybe I understand wrong way about this full code because I’m new for openframeworks.

Please help-


with the //setup and //draw comments i meant that, that code should go in the setup and draw functions, otherwise it’ll add a circle every frame and because of how path works whenever you draw on top of something it makes a “hole” in the previous drawing. you just need to create the shape once in setup and then draw it in the draw function

1 Like

Thank you very much- :grinning: