public static void ccDrawPoly(GL10 gl,CGPoint poli[],int numberOfPoints,boolean closePolygon){
  FloatBuffer vertices=getVertices(2 * numberOfPoints);
  for (int i=0; i < numberOfPoints; i++) {
    vertices.put(poli[i].x);
    vertices.put(poli[i].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);
  if (closePolygon)   gl.glDrawArrays(GL_LINE_LOOP,0,numberOfPoints);
 else   gl.glDrawArrays(GL_LINE_STRIP,0,numberOfPoints);
  gl.glEnableClientState(GL_COLOR_ARRAY);
  gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  gl.glEnable(GL_TEXTURE_2D);
}

public static void ccDrawPoly ( GL10 gl , CGPoint poli [ ] , int numberOfPoints , boolean closePolygon ) { FloatBuffer vertices = getVertices ( 2 * numberOfPoints ) ; for ( int i = 0 ; i < numberOfPoints ; i ++ ) { vertices . put ( poli [ i ] . x ) ; vertices . put ( poli [ i ] . 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 ) ; if ( closePolygon ) gl . glDrawArrays ( GL_LINE_LOOP , 0 , numberOfPoints ) ; else gl . glDrawArrays ( GL_LINE_STRIP , 0 , numberOfPoints ) ; gl . glEnableClientState ( GL_COLOR_ARRAY ) ; gl . glEnableClientState ( GL_TEXTURE_COORD_ARRAY ) ; gl . glEnable ( GL_TEXTURE_2D ) ; }
draws a poligon given a pointer to cgpoint coordiantes and the number of vertices . the polygon can be closed or open
