Making a simple circle

Any goods tips on that I know it must be a number of small line segments but I cant figure out the algorithm

Copy & pasted from some nearby code:

            int numSubdivisions = 32;
            
            gl.glBegin(GL.GL_LINE_STRIP);
            {
                  // Set edge colour for whole of shape
                  gl.glColor3f(1f, 1f, 1f);
                  
                  for (float angle=0; angle<=Math.PI*2; angle+=((Math.PI*2)/numSubdivisions) )
                  {

                        gl.glVertex3f(      radius*(float)Math.cos(angle) + center.x,
                                                radius*(float)Math.sin(angle) + center.y, Renderer.WIREFRAME_RENDER_DEPTH);
                        
                  }
                  
                  gl.glVertex3f(center.x+radius, center.y, Renderer.WIREFRAME_RENDER_DEPTH);
            }
            gl.glEnd();

Obviously you might want to switch the depth or even the axies depending on which plane you want it to lie. I suppose it might be a better idea to use LINE_LOOP and omit the last vertex as well.

thanks it works perfectly :slight_smile: