I use OpenGL ES on the main screen of the iPad (or iPhone, iPod Touch), and I would like to display on the external screen when the content has "moved" to the external screen as soon as the user connects one (and returns to the main screen when the external screen is turned off) . I use a library that makes OpenGL calls (at least those that are platform independent, i.e. do not integrate like EAGL and CAEAGL), but have a small state. What would be the best way (in terms of performance and then maintenance) to keep doing this?
- I donβt think it is supported, and even if that were the case, I donβt think it recommended just moving the view supported by CAEAGLLayer to a new window
- Otherwise, therefore, I have two possibilities. Should I store one EAGLContext, disconnect it from the CAEAGLLayer of the main screen and attach it to the CAEAGLLayer of the external display (and vice versa, when the user turns off the external display)?
- Should I have two contexts and try to use the same instance of the wrapper library (which, therefore, will have to be reconfigured, although it should be to some extent, even if I kept the same context due to different aspects of the screen sides of pixels, etc.).
- Should I have two contexts and one wrapper library instance for each context (the advantage is that I can make an ivar library instance of my custom UIView supported by CAEAGLLayer).
- Should I use two contexts, but use a partition group to share some resources?
What does Apple recommend (if there is one recommendation)? And how did you guys do it (donβt tell me this is an unusual feature!)?
source share