I am looking to implement texture sharing between two EGL contexts in two different threads. One thread to do the drawing, and one to load the textures.
Are there any examples of how to do this?
If I am just loading a texture from a context do I need to call:
Yes, you do need to make the context current to the thread to operate on it, and unfortunately the EGL spec also requires a surface for it, which may not currently be in use by another thread.
So it appears “eglCreateContext” is returning a valid context, but that “eglMakeCurrent” thinks it is a “EGL_BAD_CONTEXT” when passed a shared-context.
Right now I suspect this is an implementation dependent issue, but if I am doing anything wrong, please let me know.
why do you need to different contexts…? I mean you can use one context only for texture sharing. And threads can share the context, only the condition is that while using shared context, you have to use some mutex / semaphores for synchronization as 1 context can be current to only one thread at a time.
You can create eglimage and attach texture to it in first thread. And use this eglimage texture directly in another thread.
If you want to keep two CPU cores busy or upload textures in the background, having multiple contexts are useful.
A 1x1 pbuffer surface is usually a good choice.
That looks correct, it’s possible your platform doesn’t support shared contexts. They’re not the most typical use-case and often support for them can get left for last.