It's really just a bunch of trig functions. Here is a demo program showing how to draw a regular polygon, set the amount of sides, position, rotation, etc. If perhaps you need something more advanced such as 3D polygons then thats a little too much out of my league c:. Hope it helps!