drawing a smooth circle

hi. I am new to openGL and would like to draw a smooth circle…
Can anyone hint me ?

Should I use gl.glBegin(GL.GL_LINE_STRIP) and some sine, cosin in it??


Something like this…

const float DEG2RAD = 3.14159/180;
void drawCircle(float radius)
   for (int i=0; i < 360; i++)
      float degInRad = i*DEG2RAD;

Do remember that Google is your friend… You could have found this with less typing and got a quicker answer with a Google search. :slight_smile:

Other solution can be to fake a circle by using gluDisk() and set parameters accordingly. i.e set inner radius equal to outer radius.

Another method can be to go for subdivision curves , midpoint , catmull clark if you want to go for higher precision.

Or you can draw it using NURBS.

You can not get a perfect circle though.

And if you want it to be really really smooth, check out GL_LINE_SMOOTH (hint: enable blending).

thank you very much .
I have done it.

				for(int i =0; i <= 300; i++){
					double angle =  2 * Math.PI * i / 300;
					double x = Math.cos(angle);
					double y = Math.sin(angle);

Check out this site: http://slabode.exofire.net/circle_draw.shtml

The code there draws circles and arcs without using sine or cosine and is very fast.