How to render nice 3d2d circles. Help!

So basically I’m dumb. I’ve been trying to rende a nice looking 3d2d circle on the ground but when I use render.DrawPoly, the circle is extremely jagged.
I was wondering if anyone could possibly help me out, I’m a bit thick headed when it comes to rendering.

making the circle table for drawpoly:



local circle = {}
for i = 1, 255 do
    circle* = { x = math.cos((360/255) * i) * radius, y = math.sin((360/255) * i) * radius }
end


rendering the poly:



cam.Start3D2D( pos, Angle(0,0,0), 1 )
    surface.SetDrawColor( color )
    draw.NoTexture()
    surface.DrawPoly( circle )
cam.End3D2D()


Here’s what the result looks like: http://imgur.com/5LkGhId

So if anyone knows how to easily render a circle that doesn’t look like utter crap, I’d be very grateful :slight_smile:

cos and sin take radians as arguments, and since it will still be blurry, lower the scale of the cam and increase the size of the circle, it’ll look the same but since it gets downscaled it’ll look better

I tried that, it doesn’t work. I multiplied the radius by 10 and downscaled to 10%. I got the same jagged-edge effect.

I’d recommend creating the circle once, however large it should be, then using that table for drawing any / all polys… If it changes on resolution, only change it on resolution change…

Here’s a simple draw poly script for the circle. It is what I use for my speedometer set the slices / points value to 16, 32, or whatever ( how ever many points it should have, the more there are the smoother it is… with 4 it shows up as a diamond ).
https://dl.dropboxusercontent.com/u/26074909/tutoring/poly/simplified_circles_with_poly.lua.html

you have to convert your arguments to radians, 360/155 radians is 80.8881593 degrees

your poly looks like this

http://puu.sh/bNZu5/4c38cb76ae.png

which is why it’s pointy

Wow, thank you very much! All I had to do was convert to radians and I get a beautifully rendered circle with no jagged edges :slight_smile: