Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Arcs of round rectangle are not a consistant thickness

This thread is locked; no one can reply to it. rss feed Print
Arcs of round rectangle are not a consistant thickness
jmasterx
Member #11,410
October 2009

Hello,

I want to use round rectangles for my Gui, but the radii arcs are way thicker than they should be, how can I get a nice consistent look?Its not aliasing, that just would look jagged.

My code uses this:
paintargs.graphics()->drawRoundedRectangle(getBoundingRectangle(),AguiSize(25,25),
AguiColor(255,0,0),2);

so basically, thickness of 2, radius of 25.
I attached a picture of the problem.

Thanks

{"name":"602777","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/7\/87b6f8881a8228274ec709ee49f505e7.png","w":457,"h":188,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/7\/87b6f8881a8228274ec709ee49f505e7"}602777

SiegeLord
Member #7,827
October 2006
avatar

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

jmasterx
Member #11,410
October 2009

Yes:

void AguiAllegro5GraphicsManager::drawRoundedRectangle( 
  const AguiRectangle &rect, const AguiSize &roundRadii, 
  const AguiColor &color, const float &thickness /*= 1.0f*/ )
{
  al_draw_rounded_rectangle(rect.getLeft(),rect.getTop(),
    rect.getRight(),rect.getBottom(),
    roundRadii.getWidth(),roundRadii.getHeight(),
    getColor(color),thickness);
}

It gets worse as I increase thickness so its clearly not a sub pixel issue

It looks correct when I draw hairline (thickness <= 0) but I need thicker

SiegeLord
Member #7,827
October 2006
avatar

I can't reproduce it here... are you sure your thickness is exactly 2?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

jmasterx
Member #11,410
October 2009

Could it be because I'm not using 5.0RC2, i'm using 4.9.22, I tried 2, 2.0f, 3, 3.0f, 3.5f, same issues

SiegeLord
Member #7,827
October 2006
avatar

Are you using Direct3D by any chance? What happens if you set it to use OpenGL?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

jmasterx
Member #11,410
October 2009

Tried default (D3D) , GL, GL_3_0, but still all looks the same

hmm.. doing this in the main loop looks fine: al_draw_rounded_rectangle(0,0,200,200,25,25,al_map_rgba_f(0.5,0,0,1.0f),3);

Ill check my clipping rects

Ok that was it problem solved,
Thanks

SiegeLord
Member #7,827
October 2006
avatar

Almost gave me a heart attack :P
Glad it's solved.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: