- procedure TForm1.DrawCircle(cx, cy: extended; r, iNumSegments :integer);
- var
- theta, c, s, t : extended;
- i :integer;
- x, y : extended;
- begin
- theta := 2 * 3.1415926 / iNumSegments;
- c := cos(theta);//precalculate the sine and cosine
- s := sin(theta);
- //t;
- x := r;//we start at angle = 0
- y := 0;
- glBegin(GL_LINE_STRIP);
- for i := 0 to iNumSegments do
- begin
- glVertex2f(x + cx, y + cy);//output vertex
- //apply the rotation matrix
- t := x;
- x := c * x - s * y;
- y := s * t + c * y;
- end;
- glEnd();
- end;