I'm working on a game in which the game elements look like they are made of construction paper. To achieve the texture effect I blend a fullscreen image at the end of each draw cycle:
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
// ... draw things ... //
CGContextSetBlendMode(context, kCGBlendModeHardLight);
CGContextSetAlpha(context, 0.4);
CGContextDrawImage(context, [self frame], [paperTexture CGImage]);
}
Unfortunately this makes the frame rate drop from 60 to what feels like ~10. Is there a better way to do this without moving into OpenGL?
查看我听说过的GPUImage确实具有出色的性能。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.