Hi, all!
I am novice in OpenGL ES so your help will be much appreciated.
I have a code which cuts part of images (something like mozaik image) and shows it on the screen:
UIImage *top = [images objectAtIndex:0];
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, pageWidth, 480, 8, 4 * pageWidth, colorSpace, kCGImageAlphaPremultipliedFirst);
CGRect rect = CGRectMake(0, 0, pageWidth, 480);
CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, 0, 480);
CGContextAddLineToPoint(context, 320, 480);
CGContextAddLineToPoint(context, 320, 480 - coordY1);
CGContextAddLineToPoint(context, coordX1, 480 - coordY2);
CGContextAddLineToPoint(context, coordX2, 0);
CGContextClosePath(context);
CGContextClip(context);
CGContextDrawImage(context, rect, top.CGImage);
CGImageRef imageMasked = CGBitmapContextCreateImage(context);
CGContextRelease(context);
UIImage *newImage = [UIImage imageWithCGImage:imageMasked];
CGImageRelease(imageMasked);
It works very slow on the device. So I suggest to you OpenGL ES for rendering.
Please suggest how this code can be rewritten with OpenGL ES?