title: convert an array of NSValues / CGPoints to a CGPoint struct for use with glDrawArrays in cocos2d
body: <p>I'm pretty new to Objective-C and even C in general here, so please bear with me. My main goal is to display my NSMutableArray of CGPoints (via NSValue) with glDrawArrays(GL_LINE_STRIP, 0, points);</p>
  
  <p>I noticed that cocos2d requires an array(?) pointer <code>*poli</code> like so:</p>
  
  <pre>
  <code>
  void ccDrawPoly( CGPoint *poli, int points, BOOL closePolygon ) { ... }
  </code>
  </pre>
  
  <p>So I tried to convert my NSMutableArray to a C array and I can access/debug the CGPoints just fine:</p>
  
  <pre>
  <code>
  NSUInteger count = [points count];
  id *buffer = malloc(sizeof(NSValue) * count);
  [points getObjects: buffer];
  for(uint i = 0; i &lt; count; i++) {
    NSValue *val = buffer[i];
    CGPoint p = [val CGPointValue];
    NSLog(@"points x %i: %f", i, p.x);
    /* shows up in the console as:
    -----------points at 0: 42.000000
    -----------points at 1: 44.000000
    ... etc
    */
  }
  free(buffer);
  </code>
  </pre>
  
  <p>But I guess where I'm stuck is getting them into a data type that either <code>ccDrawPoly</code> or <code>glDrawArrays(GL_LINE_STRIP, 0, points)</code> will accept. Which is apparently a struct or something, but I'm not sure how to get them into a struct.</p>
  
  <p>Any help would be greatly appreciated! Thanks!</p>