From 3b21365e94720965a6f0a3184d7d53d76f6f21d8 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 28 Jan 2019 00:33:19 +0000 Subject: [PATCH] gl_common: fix rendering Signed-off-by: Yuxuan Shui --- src/backend/gl/gl_common.c | 2 +- src/backend/gl/glx.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index 3846fd4..ef30984 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -252,7 +252,7 @@ bool gl_compose(const gl_texture_t *ptex, int x, int y, int dx, int dy, int widt GLfloat texture_x2 = texture_x1 + (double)(crect.x2 - crect.x1); GLfloat texture_y2 = texture_y1 + (double)(crect.y2 - crect.y1); - if (GL_TEXTURE_2D == ptex->target) { + if (ptex->target == GL_TEXTURE_2D) { // GL_TEXTURE_2D coordinates are 0-1 texture_x1 /= ptex->width; texture_y1 /= ptex->height; diff --git a/src/backend/gl/glx.c b/src/backend/gl/glx.c index 012c8cf..cb54e21 100644 --- a/src/backend/gl/glx.c +++ b/src/backend/gl/glx.c @@ -564,6 +564,8 @@ void *glx_prepare_win(void *backend_data, session_t *ps, win *w) { glBindTexture(target, 0); wd->texture.texture = texture; + wd->texture.width = w->widthb; + wd->texture.height = w->heightb; return wd; err: if (wd->pixmap && wd->pixmap != w->id) { @@ -613,7 +615,7 @@ static void glx_compose(void *backend_data, session_t *ps, win *w, void *win_dat struct _glx_data *gd = backend_data; struct _glx_win_data *wd = win_data; - gl_compose(&wd->texture, 0, 0, dst_x, dst_y, w->widthb, w->heightb, 0, 0, false, + gl_compose(&wd->texture, 0, 0, dst_x, dst_y, w->widthb, w->heightb, 0, 1, true, false, region, &gd->win_shader); }