From 17341d160df36a67e720972fd696e3644f5bf18c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 25 Feb 2014 07:45:43 +0000 Subject: [PATCH] fixing gui glitch when tesselating unclosed polygons refs #36 git-svn-id: file:///home/behr_mi/git/sumo_synched/trunk@15724 afbd958f-9f77-42d5-a016-97a22340ccf4 --- sumo/src/utils/gui/div/GLHelper.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sumo/src/utils/gui/div/GLHelper.cpp b/sumo/src/utils/gui/div/GLHelper.cpp index 243bb653f65..7a95be4e5a8 100644 --- a/sumo/src/utils/gui/div/GLHelper.cpp +++ b/sumo/src/utils/gui/div/GLHelper.cpp @@ -99,7 +99,7 @@ GLHelper::drawFilledPolyTesselated(const PositionVector& v, bool close) { gluTessProperty(tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD); gluTessBeginPolygon(tobj, NULL); gluTessBeginContour(tobj); - double* points = new double[v.size() * 3]; + double* points = new double[(v.size() + int(close)) * 3]; for (size_t i = 0; i != v.size(); ++i) { points[3 * i] = v[(int)i].x(); @@ -108,7 +108,11 @@ GLHelper::drawFilledPolyTesselated(const PositionVector& v, bool close) { gluTessVertex(tobj, points + 3 * i, points + 3 * i); } if (close) { - gluTessVertex(tobj, points + 3, points + 3); + const size_t i = v.size(); + points[3 * i] = v[0].x(); + points[3 * i + 1] = v[0].y(); + points[3 * i + 2] = 0; + gluTessVertex(tobj, points + 3 * i, points + 3 * i); } gluTessEndContour(tobj); gluTessEndPolygon(tobj);