I have some issues with the eglMakeCurrent() specification.
What I'm trying to do is to have multiple threads that render to the same surface.
So I'm creating a single EGLSurface form the window native surface and then an EGLContext for each thread.
Each thread calls the eglMakeCurrent function passing the eglSurface (for both read/write) and its own eglContext.
In this way I have a context current only on one thread.
I tried this solution on the OpenGL|ES Java binding on the Android platform and when the second thread call the eglMakeCurrent() i get an EGL_BAD_ACCESS error. The documentation (http://www.khronos.org/opengles/sdk/1.1 ... urrent.xml) says:
and I'm sure that the context is a brand new context that cannot be current on any other thread.EGL_BAD_ACCESS is generated if context is current to some other thread.
So the OpenGL|ES documentation doesn't specify clearly that my code is invalid.
But to be really sure that the problem is not my implementation that is buggy, I went an read the specification. In the section 3.7.3 of the eglspec.1.1.pdf (November 10, 2004) it's written:
Because I'm sure that the OpenGL|ES Java binding on the J2ME platform allows to have multiple context bound to the same surface, I tried a native implementation.Only one rendering context may be in use, or current, for a particular thread at a given time, and only one context may be bound to a particular surface at a given time.
Using the Imagination Technolgies SDK (PCEMULATION build 2.04.24.0811) I saw that I can bound multiple context to the same surface. That is, the multi-thread approch with each thread its own EGLContext works fine.
So here is the final question: who is doing wrong? Me, Android, Java or Imagination Technologies?