progs/es1: Bind texture image after rendering.
authorChia-I Wu <olvaffe@gmail.com>
Mon, 11 Jan 2010 05:53:03 +0000 (13:53 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 12 Jan 2010 03:25:09 +0000 (11:25 +0800)
Unlike FBO, eglBindTexImage is supposed to be called after rendering.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
progs/es1/xegl/render_tex.c

index 0d1027b7128fa3330916314c6966dc6cba2b3b7d..0200fa4cb06c07f7add81e9959855ecc8af962b6 100644 (file)
@@ -229,17 +229,19 @@ draw(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
       printf("Error: eglMakeCurrent(pbuf) failed\n");
       return;
    }
-   glBindTexture(GL_TEXTURE_2D, RenderTexture);
-   eglBindTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
    draw_torus_to_texture();
-   eglReleaseTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
 
    /* draw textured quad to window */
    if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
       printf("Error: eglMakeCurrent(pbuffer) failed\n");
       return;
    }
+
+   glBindTexture(GL_TEXTURE_2D, RenderTexture);
+   eglBindTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
    draw_textured_quad();
+   eglReleaseTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
+
    eglSwapBuffers(egl_dpy, egl_surf);
 
    /*printf("End draw\n");*/