Does anyone have any code to create a second GLES context?
I'm looking to run two threads sharing texture and shader resources.
I'm basing my demo on hello_triangle 2.
void CreateSecondaryOpenGLContext()
{
static const EGLint context_attributes[] =
{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
EGLContext context = eglCreateContext(GlobalOpenGlState->display,
GlobalOpenGlState->config,
GlobalOpenGlState->context,
context_attributes);
// release surface so that second thread can render
eglMakeCurrent(GlobalOpenGlState->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
// connect the context to the surface
int result = eglMakeCurrent(GlobalOpenGlState->display, GlobalOpenGlState->surface, GlobalOpenGlState->surface, context);
assert(EGL_FALSE != result);
check();
}
The assertion fails. Any thoughts?