I am using a pbuffer in OpenGL ES 1.1 to render to texture. I followed the information in this post here
http://discussion.forum.nokia.com/forum/showthread.php?159777-OpenGL-render-to-texture&p=548409&viewfull=1#post548409
.
Like the poster in that thread I have two contexts, one for the main window and one for the pbuffer. I render to the pbuffer surface and then the window surface draws a quad using the pbuffer as a texture.
What I’ve found is that to get eglBindTexImage to actually contain the pbuffer contents I had to do
// Need to set the surface to the pbuffer, but the context to the window context that
// is going to use texture
eglMakeCurrent(display, pbufferSurface, pbufferSurface, windowContext);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, pbufferTexture);
eglBindTexImage(g_display, pbufferSurface, EGL_BACK_BUFFER))
// Set the surface and context to the window ready for the actual draw
eglMakeCurrent(display, windowSurface, windowSurface, windowContext);
Can someone explain to me why the the first eglMakeCurrent has to be pbufferSurface but windowContext? I would have expected windowSurface,windowContext to be the correct setting, but that creates a texture with the current contents of the windowSurface (which I find really strange).
Cheers,
Stuart.