I'm trying to load gl resources like textures, shaders and mesh on a different thread than the main one (where I do my rendering stuff)
For this, I tried to create use shared context from the EGL lib, but I get an error even if all seems to be working...
I proceed like this :
Using cpp Syntax Highlighting
- EGLConfig m_config; // configuration properly choosed and set
- EGLSurface m_surface; // surface properly created
- EGLDisplay m_display; // main display
- // Context attributes
- static const EGLint contextAttribList[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
- EGLContext sharedContext; // The shared context that will never be made current
- EGLContext mainContext; // The context of the main thread
- sharedContext = eglCreateContext(m_display, m_config, EGL_NO_CONTEXT, contextAttribList);
- mainContext = eglCreateContext(m_display, m_config, sharedContext, contextAttribList);
- eglMakeCurrent(m_display, m_surface, m_surface, mainContext);
Parsed in 0.006 seconds, using GeSHi 1.0.8.4
Then, later, I create my another context from the other thread, using the same config, display and surface:
Using cpp Syntax Highlighting
- EGLContext otherContext = eglCreateContext(m_display, m_config, sharedContext, contextAttribList);
- eglMakeCurrent(m_display, m_surface, m_surface, otherContext); //!\ Generate EGL_BAD_ACCESS error
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
I got an EGL_BAD_ACCESS, but I never made the otherContext current to any existing thread.
I'm using a Galaxy Tab 2.0 7" to do my tests, does anyone encountered the same issue?


