在glpaint裡要把畫面存成照片需要加入以下的程式碼。 void ProviderReleaseData ( void *info, const void *data, size_t size ) { free((void*)data); } -(UIImage*) upsideDownImageRepresenation{ int imageWidth = CGRectGetWidth([self bounds]); int imageHeight = CGRectGetHeight([self bounds]); //image buffer for export NSInteger myDataLength = imageWidth* imageHeight * 4; // allocate array and read pixels into it. GLubyte *tempImagebuffer = (GLubyte *) malloc(myDataLength); glReadPixels(0, 0, imageWidth, imageHeight, GL_RGBA, GL_UNSIGNED_BYTE, tempImagebuffer); // make data provider with data. CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, tempImagebuffer, myDataLength, ProviderReleaseData); // prep the ingredients int bitsPerComponent = 8; int bitsPerPixel = 32; int bytesPerRow = 4 * imageWidth; CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); CGBitmapInf...