diff --git a/gfx/gl.c b/gfx/gl.c index 722cd134b8..be89557dc8 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -242,31 +242,19 @@ static void gl_set_coords(const struct gl_coords *coords) { pglClientActiveTexture(GL_TEXTURE0); - if (coords->vertex) - { - glVertexPointer(2, GL_FLOAT, 0, coords->vertex); - glEnableClientState(GL_VERTEX_ARRAY); - } + glVertexPointer(2, GL_FLOAT, 0, coords->vertex); + glEnableClientState(GL_VERTEX_ARRAY); - if (coords->color) - { - glColorPointer(4, GL_FLOAT, 0, coords->color); - glEnableClientState(GL_COLOR_ARRAY); - } + glColorPointer(4, GL_FLOAT, 0, coords->color); + glEnableClientState(GL_COLOR_ARRAY); - if (coords->tex_coord) - { - glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - } + glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); - if (coords->lut_tex_coord) - { - pglClientActiveTexture(GL_TEXTURE1); - glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - pglClientActiveTexture(GL_TEXTURE0); - } + pglClientActiveTexture(GL_TEXTURE1); + glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + pglClientActiveTexture(GL_TEXTURE0); } #endif diff --git a/gfx/shader_glsl.c b/gfx/shader_glsl.c index 463c5ba97f..1095006f48 100644 --- a/gfx/shader_glsl.c +++ b/gfx/shader_glsl.c @@ -1299,48 +1299,38 @@ bool gl_glsl_set_coords(const struct gl_coords *coords) if (!glsl_enable || !glsl_modern) return false; - if (coords->tex_coord) + int loc; + + loc = pglGetAttribLocation(gl_program[active_index], "rubyTexCoord"); + if (loc >= 0) { - int loc = pglGetAttribLocation(gl_program[active_index], "rubyTexCoord"); - if (loc >= 0) - { - pglEnableVertexAttribArray(loc); - pglVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, 0, coords->tex_coord); - gl_attribs[gl_attrib_index++] = loc; - } + pglEnableVertexAttribArray(loc); + pglVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, 0, coords->tex_coord); + gl_attribs[gl_attrib_index++] = loc; } - if (coords->vertex) + loc = pglGetAttribLocation(gl_program[active_index], "rubyVertexCoord"); + if (loc >= 0) { - int loc = pglGetAttribLocation(gl_program[active_index], "rubyVertexCoord"); - if (loc >= 0) - { - pglEnableVertexAttribArray(loc); - pglVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, 0, coords->vertex); - gl_attribs[gl_attrib_index++] = loc; - } + pglEnableVertexAttribArray(loc); + pglVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, 0, coords->vertex); + gl_attribs[gl_attrib_index++] = loc; } - if (coords->color) + loc = pglGetAttribLocation(gl_program[active_index], "rubyColor"); + if (loc >= 0) { - int loc = pglGetAttribLocation(gl_program[active_index], "rubyColor"); - if (loc >= 0) - { - pglEnableVertexAttribArray(loc); - pglVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, 0, coords->color); - gl_attribs[gl_attrib_index++] = loc; - } + pglEnableVertexAttribArray(loc); + pglVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, 0, coords->color); + gl_attribs[gl_attrib_index++] = loc; } - if (coords->lut_tex_coord) + loc = pglGetAttribLocation(gl_program[active_index], "rubyLUTTexCoord"); + if (loc >= 0) { - int loc = pglGetAttribLocation(gl_program[active_index], "rubyLUTTexCoord"); - if (loc >= 0) - { - pglEnableVertexAttribArray(loc); - pglVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, 0, coords->lut_tex_coord); - gl_attribs[gl_attrib_index++] = loc; - } + pglEnableVertexAttribArray(loc); + pglVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, 0, coords->lut_tex_coord); + gl_attribs[gl_attrib_index++] = loc; } return true;