私はコードを持っています:
NSMutableArray *vertices = [[NSMutableArray alloc] init];
//Getting mouse coordinates
loc = [self convertPoint: [event locationInWindow] fromView:self];
[vertices addObject:loc]; // Adding coordinates to NSMutableArray
//Converting from NSMutableArray to GLfloat to work with OpenGL
int count = [vertices count] * 2; // * 2 for the two coordinates of a loc object
GLFloat []glVertices = (GLFloat *)malloc(count * sizeof(GLFloat));
int currIndex = 0;
for (YourLocObject *loc in vertices) {
glVertices[currIndex++] = loc.x;
glVertices[currIndex++] = loc.y;
}
loc
はCGPointなので、CGPointからNSValueに変更してNSMutableArrayに追加し、その後CGPointに戻す必要があります。どうすればそれができますか?