PDA

View Full Version : texture dosn`t bind to p-buffer at first time



Aleksey Protsenko
09-02-2010, 07:12 AM
Hello.
I`m trying to work with p-buffer, and now i have some strange situation.
I do next:

...initialization...

for(some cycle)
{
eglBindAPI(EGL_OPENVG_API);
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) ;
eglMakeCurrent(eglDisplay, eglPBuffer, eglPBuffer, vglContext); //binding p-buffer and openvg context

//now i draw something to p-buffer via OpenVG

eglBindAPI(EGL_OPENGL_ES_API);
glBindTexture(GL_TEXTURE_2D, TexID);
eglBindTexImage(eglDisplay, eglPBuffer, EGL_BACK_BUFFER);

//now i draw something and use p-buffer as texture via OpenGL ES
eglSwapBuffers(eglDisplay, eglSurface);

eglReleaseTexImage(eglDisplay, eglPBuffer, EGL_BACK_BUFFER);
}

...

It works fine, but! At first time texture contains some thrash, but not that i had drawn.
At second time of cycle, and after, it works properly.
Maybe it is because drawing goes to back buffer, and texture are binding to front buffer?
But third parameter of eglBindTexImage can be only EGL_BACK_BUFFER.
I`d try to set vgFinish or eglSwapBuffers but it doesn`t help.

Thanks.