Skip to content

Commit

Permalink
fixing gui glitch when tesselating unclosed polygons refs #36
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/behr_mi/git/sumo_synched/trunk@15724 afbd958f-9f77-42d5-a016-97a22340ccf4
  • Loading branch information
namdre committed Feb 25, 2014
1 parent 7a397c3 commit 17341d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sumo/src/utils/gui/div/GLHelper.cpp
Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit 17341d1

Please sign in to comment.