I have an OpenGL ES application that works on both iOS and Android. Most of the code was written many years ago by another person, and now I have to support it. Using OpenGL seems pretty straightforward (a 2D game and uses only textured sprites in a simple way). But I see two significant differences in the implementation of graphical code for iOS and Android:
1) The iOS code contains this code:
glGenFramebuffersOES(1, &m_defaultFramebuffer);
glGenRenderbuffersOES(1, &m_colorRenderbuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, m_defaultFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_colorRenderbuffer);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorRenderbuffer);
and Android not.
2) When the Android application goes into the background, all OpenGL textures are destroyed ( glDeleteTextures), and EGL is disabled using eglTerminate. When the application returns from sleep, the EGL is reinitialized and the textures are recreated.
The iOS code does not do this. It just pauses the rendering cycle, causing[m_displayLink setPaused:YES];
, OpenGL, iOS Android.
, , . - ?