public static void ccDrawCircle(GL10 gl,CGPoint center,float r,float a,int segments,boolean drawLineToCenter){
  FloatBuffer vertices=getVertices(2 * (segments + 2));
  int additionalSegment=1;
  if (drawLineToCenter)   additionalSegment++;
  final float coef=2.0f * (float)Math.PI / segments;
  for (int i=0; i <= segments; i++) {
    float rads=i * coef;
    float j=(float)(r * Math.cos(rads + a) + center.x);
    float k=(float)(r * Math.sin(rads + a) + center.y);
    vertices.put(j);
    vertices.put(k);
  }
  vertices.put(center.x);
  vertices.put(center.y);
  vertices.position(0);
  gl.glDisable(GL_TEXTURE_2D);
  gl.glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  gl.glDisableClientState(GL_COLOR_ARRAY);
  gl.glVertexPointer(2,GL_FLOAT,0,vertices);
  gl.glDrawArrays(GL_LINE_STRIP,0,segments + additionalSegment);
  gl.glEnableClientState(GL_COLOR_ARRAY);
  gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  gl.glEnable(GL_TEXTURE_2D);
}

public static void ccDrawCircle ( GL10 gl , CGPoint center , float r , float a , int segments , boolean drawLineToCenter ) { FloatBuffer vertices = getVertices ( 2 * ( segments + 2 ) ) ; int additionalSegment = 1 ; if ( drawLineToCenter ) additionalSegment ++ ; final float coef = 2.0f * ( float ) Math . PI / segments ; for ( int i = 0 ; i <= segments ; i ++ ) { float rads = i * coef ; float j = ( float ) ( r * Math . cos ( rads + a ) + center . x ) ; float k = ( float ) ( r * Math . sin ( rads + a ) + center . y ) ; vertices . put ( j ) ; vertices . put ( k ) ; } vertices . put ( center . x ) ; vertices . put ( center . y ) ; vertices . position ( 0 ) ; gl . glDisable ( GL_TEXTURE_2D ) ; gl . glDisableClientState ( GL_TEXTURE_COORD_ARRAY ) ; gl . glDisableClientState ( GL_COLOR_ARRAY ) ; gl . glVertexPointer ( 2 , GL_FLOAT , 0 , vertices ) ; gl . glDrawArrays ( GL_LINE_STRIP , 0 , segments + additionalSegment ) ; gl . glEnableClientState ( GL_COLOR_ARRAY ) ; gl . glEnableClientState ( GL_TEXTURE_COORD_ARRAY ) ; gl . glEnable ( GL_TEXTURE_2D ) ; }
draws a circle given the center , radius and number of segments .
