EGL Context sharing issue

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

EGL Context sharing issue

Remi Boullerne
Hey there,

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 :

*Begin Code*
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);
*End Code*

Then, later, I create my another context from the other thread, using the same config, display and surface:

*Begin Code*
EGLContext otherContext = eglCreateContext(m_display, m_config, sharedContext, contextAttribList);
eglMakeCurrent(m_display, m_surface, m_surface, otherContext); //!\ Generate EGL_BAD_ACCESS error
*End Code*

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?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/FkD4Hx78daUJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.