I’m writing an Android application with OpenGL ES 2.0 that requires frequent texture loading and unloading. The optimal solution for me is to do this on a background thread to maintain responsiveness and to keep the architecture simple. It would also be easiest to handle everything in Java’s GLSurfaceView; I’m trying to stay away from writing any native code.
So with those constraints in mind, what’s the right way to load textures on a non-render thread in Android? I’ve found surprisingly little information on this topic. I know I need a second EGLContext and that I probably have to bind it on the loading thread with eglMakeCurrent(). That call also requires EGLDisplay and EGLSurface objects. I know I can get the EGL object with EGLContext.getEGL(). With that, I can get the current context, display, and surface(s). Should it be as simple as getting these object references and then calling eglMakeCurrent() on the loading thread? Or is there more to it? Do i need to hook into the EGLContextFactory and EGLWindowSurfaceFactory? Do I actually need a second GLSurfaceView?
Any direction you all can provide will be greatly appreciated.