diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 6782a1170a..2113894f2e 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -826,11 +826,11 @@ void OPENGL_GAL::DrawPolygon( const SHAPE_POLY_SET& aPolySet ) for( int j = 0; j < aPolySet.OutlineCount(); ++j ) { const SHAPE_LINE_CHAIN& outline = aPolySet.COutline( j ); - const int pointCount = outline.PointCount(); + const int pointCount = outline.SegmentCount() + 1; std::unique_ptr points( new GLdouble[3 * pointCount] ); GLdouble* ptr = points.get(); - for( int i = 0; i < outline.PointCount(); ++i ) + for( int i = 0; i < pointCount; ++i ) { const VECTOR2I& p = outline.CPoint( i ); *ptr++ = p.x;