title: How correctly draw a polygon with OpenTK
body: <p>I'm new to <strong>OpenTK</strong> and I'm using the following code to draw large number of polygons using <strong>OpenTK</strong></p>
  
  <pre><code>public static void DrawPolygon(Point[] points)
  {
      GL.Begin(BeginMode.Polygon); //IF I Change this to LineStrip every things will be OK
      int numberOfPoints = points.Length;
      for (int i = 0; i &lt; numberOfPoints; i++)
      {
          GL.Vertex2(points[i].X, points[i].Y);
      }
      GL.End();
  }
  </code></pre>
  
  <p>And this is the configuration code which executes before calling the <code>DrawPolygon</code></p>
  
  <pre><code>GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
  
  GL.MatrixMode(MatrixMode.Projection);
  GL.LoadIdentity();
  GL.Ortho(0, width, 0, height, -1, 1); // Bottom-left corner pixel has coordinate (0, 0)
  GL.Viewport(0, 0, (int)width, (int)height); 
  
  GL.ClearColor(drawing.Color.Transparent);
  
  GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
  
  GL.MatrixMode(MatrixMode.Modelview);
  GL.LoadIdentity();
  GL.Color3(pen.Color);
  GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
  GL.PointSize(5f);
  GL.LineWidth(2f);
  </code></pre>
  
  <p>Using this code when I save the rendered image to disk as png, the result will be like this</p>
  
  <p><a href="https://i.stack.imgur.com/NWY8W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NWY8W.png" alt="enter image description here"></a></p>
  
  <p><strong>result for:<code>GL.Begin(BeginMode.Polygon);</code></strong></p>
  
  <p>However If I change the first line of the <code>DrawPolygon</code> to <code>GL.Begin(BeginMode.LineStrip);</code> the polygon would be rendered as expected like this:</p>
  
  <p><a href="https://i.stack.imgur.com/K2jLO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K2jLO.png" alt="enter image description here"></a></p>
  
  <p><strong>result for : <code>GL.Begin(BeginMode.LineStrip);</code></strong></p>
  
  <p>Anyone knows why those two extra lines appears when using <code>BeginMode.Polygon</code>? </p>