Imagination PowerVR SDK Blog

Thread


#1

Hi everyone,

In my application i have the current setup under windows :

- Main Thread with a standard WndProc and a classic while loop in the main()
- Game Thread : handle logic and display

In the main thread im creating the window and setup the device but when i trigger the game thread i setup a new GL Context to be able to createtexture and rendering stuff. by this piece of code :

Code:

            localContext = eglCreateContext(CIgGLRenderer::GetInstance()->eglDisplay, CIgGLRenderer::GetInstance()->eglConfig, CIgGLRenderer::GetInstance()->eglContext, NULL);
            localSurface = eglCreateWindowSurface(CIgGLRenderer::GetInstance()->eglDisplay, CIgGLRenderer::GetInstance()->eglConfig, CIgGLRenderer::GetInstance()->eglWindow, NULL);

            eglMakeCurrent(CIgGLRenderer::GetInstance()->eglDisplay, localSurface, localSurface, localContext);


By doing this it seems that everything went fine but soon as i make a

eglSwapBuffers(eglDisplay, g_pRenderContext->localSurface);

i just get a blank screen with the correct clear color but no quads at all.
I searched for a solution but so far no luck.

Anyone can help ?

Thanks !





#2

I made some additionnal test :

1/ Remove the game thread
2/ Just show a texture in the main thread -> this is working without problem
3/ set NULL for the render context and makecurrent the main thread just like the first firt makecurrent call and draw a texture -> not working, just getting the clear color…

here’s the piece of code

Code:

    assert(eglMakeCurrent(pRenderer->eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)==EGL_TRUE);



then before the rendering

Code:

    EGLBoolean    ret = eglMakeCurrent(eglGetDisplay((NativeDisplayType) hDC), eglSurface, eglSurface, eglContext);

    assert(EGL_TRUE==ret);


I assume that if i can get this working then i will get the thread context working too..

Thanks