From 233edbd1c327cbb5bb9e2df013a1ea56d17b44b4 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 31 Mar 2019 18:15:14 +0100 Subject: [PATCH] gl_common: fix implicit conversion warnings Signed-off-by: Yuxuan Shui --- src/backend/gl/gl_common.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index 5f0eb7e..71ee9a8 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -256,7 +256,7 @@ void gl_compose(backend_t *base, void *image_data, int dst_x, int dst_y, GLint vy[] = {vy1, vy1, vy2, vy2}; for (int i = 0; i < 4; i++) { - glVertexAttrib2f(gd->win_shader.in_texcoord, texture_x[i], + glVertexAttrib2f((GLuint)gd->win_shader.in_texcoord, texture_x[i], texture_y[i]); glVertex3i(vx[i], vy[i], 0); } @@ -381,7 +381,8 @@ bool gl_blur(backend_t *base, double opacity, const region_t *reg_blur, GLint vy[] = {vy1, vy1, vy2, vy2}; for (int k = 0; k < 4; k++) { - glVertexAttrib2f(p->in_texcoord, texture_x[k], texture_y[k]); + glVertexAttrib2f((GLuint)p->in_texcoord, texture_x[k], + texture_y[k]); glVertex3i(vx[k], vy[k], 0); } } @@ -458,8 +459,10 @@ void gl_resize(struct gl_data *gd, int width, int height) { gd->width = width; // Note: OpenGL matrices are column major - GLfloat projection_matrix[4][4] = { - {2.0 / width, 0, 0, 0}, {0, 2.0 / height, 0, 0}, {0, 0, 0, 0}, {-1, -1, 0, 1}}; + GLfloat projection_matrix[4][4] = {{2.0f / (GLfloat)width, 0, 0, 0}, + {0, 2.0f / (GLfloat)height, 0, 0}, + {0, 0, 0, 0}, + {-1, -1, 0, 1}}; if (gd->npasses > 0) { // Resize the temporary textures used for blur @@ -577,8 +580,8 @@ static bool gl_init_blur(struct gl_data *gd, conv *const *const kernels) { strlen(shader_body) + 10 /* sum */ + 1 /* null terminator */; char *shader_str = ccalloc(shader_len, char); - auto real_shader_len = snprintf( - shader_str, shader_len, FRAG_SHADER_BLUR, extension, shader_body, sum); + auto real_shader_len = snprintf(shader_str, shader_len, FRAG_SHADER_BLUR, + extension, shader_body, sum); CHECK(real_shader_len >= 0); CHECK((size_t)real_shader_len < shader_len); free(shader_body);