Shared context for background thread loading

Hi,

I’ve been trying to get shared context to loading opengl resources in a background thread however I’m can’t seems to get it to work.

Here is what I am doing:

mEglContextMain = eglCreateContext( mEglDisplay, mEglConfig, EGL_NO_CONTEXT, contextAttribs);

mEglContextThread = eglCreateContext( mEglDisplay, mEglConfig, mEglContextMain, contextAttribs);

mEglWindow = eglCreateWindowSurface( mEglDisplay, mEglConfig, nwt, attrib_list );

mAuxSurface = eglCreatePbufferSurface( mEglDisplay, auxConfig, pbufferAttribs);

on the main thread, I call:
eglMakeCurrent( mEglDisplay, mEglWindow, mEglWindow, mEglContextMain );

on the background loading thread (using std::thread), I call:
eglMakeCurrent( mEglDisplay, mAuxSurface, mAuxSurface, mEglContextThread);

The error I’m getting is when I call the make current call on the background thread, the main thread opengl es functions will start to give me an error of INVALID_OPERATION.

I’ve managed to get this shared context working on iPhone (xcode) and regular Opengl, but I can’t seems to get it to work with the PowerVR Imagination SDK.

Does anyone have any ideas?

Thanks.

AFIK, you cant make current two contexts at a time. Before make current of other context you need to makecurrent(NULL) previous one.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.