From 1f411902dea5451e37d94293f023fbc1f5381a0d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 29 Oct 2010 15:20:16 +0800 Subject: [PATCH] Use glTexSubImage to update the pixels. glTexImage causes respecification. The DRM buffer a client renders to will be different from that used to create the wl_buffer. --- clients/window.c | 5 ++--- compositor/compositor.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/clients/window.c b/clients/window.c index 24ec5b0..2dd7135 100644 --- a/clients/window.c +++ b/clients/window.c @@ -275,9 +275,8 @@ display_create_drm_surface_from_file(struct display *display, } surface = display_create_drm_surface(display, rect); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, - rect->width, rect->height, - 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rect->width, rect->height, + GL_RGBA, GL_UNSIGNED_BYTE, pixels); gdk_pixbuf_unref(pixbuf); diff --git a/compositor/compositor.c b/compositor/compositor.c index 7daacea..94e70a5 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -192,8 +192,8 @@ texture_from_png(const char *filename, int width, int height) else format = GL_RGB; - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, - width, height, 0, format, GL_UNSIGNED_BYTE, data); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, + format, GL_UNSIGNED_BYTE, data); gdk_pixbuf_unref(pixbuf); -- 2.7.4