From 43f67b61fd1020e7ec847c21e1dbae9544d463ec Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olvaffe@gmail.com>
Date: Mon, 11 Jan 2010 13:53:03 +0800
Subject: progs/es1: Bind texture image after rendering.

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 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/progs/es1/xegl/render_tex.c b/progs/es1/xegl/render_tex.c
index 0d1027b712..0200fa4cb0 100644
--- a/progs/es1/xegl/render_tex.c
+++ b/progs/es1/xegl/render_tex.c
@@ -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");*/
-- 
cgit v1.2.3