From 890e8f10865b248ab1f670cf44d802ab983b8b8f Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 27 Nov 2015 17:49:17 -0400 Subject: [PATCH] Simplified the code for love.graphics.arc. --- src/modules/graphics/opengl/Graphics.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index a3dc9c480..956a6e83e 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -1298,21 +1298,8 @@ void Graphics::arc(DrawMode mode, float x, float y, float radius, float angle1, coords[2 * (i+1) + 1] = y + radius * sinf(phi); } - // GL_POLYGON can only fill-draw convex polygons, so we need to do stuff manually here - if (mode == DRAW_LINE) - { - polyline(coords, num_coords); // Artifacts at sharp angles if set to looping. - } - else - { - OpenGL::TempDebugGroup debuggroup("Filled arc draw"); - - gl.prepareDraw(); - gl.bindTexture(gl.getDefaultTexture()); - gl.useVertexAttribArrays(ATTRIBFLAG_POS); - glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, coords); - gl.drawArrays(GL_TRIANGLE_FAN, 0, points + 2); - } + // NOTE: We rely on polygon() using GL_TRIANGLE_FAN, when fill mode is used. + polygon(mode, coords, num_coords); delete[] coords; }