[SOLVED]How do I set a circle resolution for ofRectRounded?

Hi, I’m trying to create a rectangle with rounded edges using ofRectRounded.

I learned there’s ofSetCircleResolution for setting resolution for ofCircle.

And I wonder how to apply this to ofRectRounded.

ofSetCircleResolution applies to ofRectRounded as well

I tried it but I don’t think it applies to ofRectRounded.

if I draw ofCircle after ofSetCircleResolution(100), the shape of circle definitely gets rounder.

But if I draw ofRectRounded with big radius value instead of ofCircle, the resolution of circle doesn’t get affected at all.

Am I doing something wrong?

1 Like

Are you using the 0.8.0 version of oF?

Yes I’m using 0.8.0 version.

Here’s my code

void testApp::draw(){

ofRectRounded(200, 200, 400, 400, 400);


With this code, It just draws a circle with 22 points which is a default resolution.
But when I draw ofCircle instead of ofRectRounded, I could see ofSetCircleResolution is applied.
Should I add any other code to make ofRectRounded to get affected?

Maybe I was wrong - I could have sworn though because I remembered being surprised it had an effect

Try ofSetCurveResolution()

default is 20

Thanks for the reply!
I tried ofSetCurveResolution(), but it doesn’t seem to work either.

Has anybody ever tried to set a circle resolution for ofRectRounded?

Nobody? Really?

It feels like a bug to me that it doesnt follow the ofSetCircleResolution.

You can patch your oF distribution :

Line 905 of ofGraphics.cpp add this :


So it will look like that :

void ofRectRounded(float x, float y, float z, float w, float h, float topLeftRadius,
                                                                float topRightRadius,
                                                                float bottomRightRadius,
                                                                float bottomLeftRadius) {
	// respect the current rectmode
	switch (ofGetRectMode()) {
			x -= w / 2.0f;
			y -= h / 2.0f;


Hey now It works!
Thank you so much silverbahamut!

that will recreat the circle cache for that shape on every call which might be super slow, the solution would be to add that in the ofSetCircleResolution function.

i’ve just fixed it in master that way

Thanks Arturo for your better fix than mine! I didn’t dig deeper than those functions, and as one line below the ofCurve function was resetting the curve resolution on every call so I assumed that was the intended behavior.