# Thread

**URL:** <https://forums.imgtec.com/t/thread/571>\
**Category:** PowerVR Insider\
**Created:** [December 28, 2009, 2:40pm UTC](https://forums.imgtec.com/t/thread/571 "2009-12-28T14:40:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zegouky](https://avatars.discourse-cdn.com/v4/letter/z/8797f3/32.png) [@zegouky](https://forums.imgtec.com/u/zegouky)\
**Post date:** [December 28, 2009, 2:40pm UTC](https://forums.imgtec.com/t/thread/571/1 "2009-12-28T14:40:15Z")

</div>

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:

  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; localContext = eglCreateContext(CIgGLRenderer::GetInstance()-\>eglDisplay, CIgGLRenderer::GetInstance()-\>eglConfig, CIgGLRenderer::GetInstance()-\>eglContext, NULL);  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; localSurface = eglCreateWindowSurface(CIgGLRenderer::GetInstance()-\>eglDisplay, CIgGLRenderer::GetInstance()-\>eglConfig, CIgGLRenderer::GetInstance()-\>eglWindow, NULL);  
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 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 !

---

<div class="post-metadata">

**Author:** ![zegouky](https://avatars.discourse-cdn.com/v4/letter/z/8797f3/32.png) [@zegouky](https://forums.imgtec.com/u/zegouky)\
**Post date:** [December 28, 2009, 3:45pm UTC](https://forums.imgtec.com/t/thread/571/2 "2009-12-28T15:45:23Z")

</div>

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:

  
&nbsp;&nbsp;&nbsp; assert(eglMakeCurrent(pRenderer-\>eglDisplay, EGL\_NO\_SURFACE, EGL\_NO\_SURFACE, EGL\_NO\_CONTEXT)==EGL\_TRUE);  

  
  
  
then before the rendering  
  

Code:

  
&nbsp;&nbsp;&nbsp; EGLBoolean&nbsp;&nbsp;&nbsp; ret = eglMakeCurrent(eglGetDisplay((NativeDisplayType) hDC), eglSurface, eglSurface, eglContext);  
  
&nbsp;&nbsp;&nbsp; assert(EGL\_TRUE==ret);  

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