In my OpenGL-ES 1.1 based application, I use CALayer as the source for OpenGL textures. Those CALayer consist of CGImage and text displayed through CoreGraphics. Another OpenGL texture source is a UIView screenshot taken using -[CALAyer renderInContext:] and UIGraphicsGetImageFromCurrentImageContext . I am currently fully running in the main thread.
The latter case, in particular, is pretty bad, because it stops rendering OpenGL for the entire time it takes to create a UIView and its screenshot.
Now I'm going to move the OpenGL code to a separate thread, hoping to get around this lock. Ideally, the screenshot will be taken in a different thread (main thread, if necessary) than the OpenGL rendering.
I could not find the full coverage in the documentation about what is needed to run in the main thread and what is not. I found some comments in the notes of iOS 4 and some comments in specific UIKit methods, but I miss the full image.
Code works on iOS 4.x or higher.
multithreading iphone uikit core-graphics opengl-es
Ortwin gentz
source share