Refresh texture when redrawing console
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 26 Nov 2011 15:46:44 +0000 (16:46 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 26 Nov 2011 15:46:44 +0000 (16:46 +0100)
We need to refresh the GL texture data when redrawing the console. Otherwise, we
always end up with the first frame mapped onto the GL quad object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/console.c

index aff870a..b70eca9 100644 (file)
@@ -214,6 +214,12 @@ void kmscon_console_draw(struct kmscon_console *con)
        // TODO: draw console here
 
        cairo_restore(con->cr);
+
+       /* refresh GL texture contents */
+       glBindTexture(GL_TEXTURE_RECTANGLE, con->tex);
+       glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, con->res_x, con->res_y,
+                               0, GL_BGRA, GL_UNSIGNED_BYTE, con->surf_buf);
+       glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 }
 
 /*