title: SharpGL: Can't draw all lines from List
body: <p>I have:</p>
  
  <pre><code>float[,] nodesN = null; //indexes:
                          //number of node;
                          //value index 0-&gt;x, 1-&gt;y, 2-&gt;temperature
  int[,] elements = null; //indexes:
                          //indexof element (triangle)
                          //1, 2, 3 - vertexes (from nodesN)
  List&lt;Pair&gt; edges = null; //Pair is a class containing two int values which are
                           //indexes of nodesN
  </code></pre>
  
  <p>And function which is supposed do all elements and edges on <code>SharpGL.OpenGLCtrl</code></p>
  
  <pre><code>    private void openGLCtrl1_Load(object sender, EventArgs e)
      {
          gl = this.glCtrl.OpenGL;
          gl.ClearColor(this.BackColor.R / 255.0f,
              this.BackColor.G / 255.0f,
              this.BackColor.B / 255.0f, 1.0f);
          gl.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT);
      }
  
      private void openGLControl1_OpenGLDraw(object sender, PaintEventArgs e)
      {
          gl.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT);
          gl.LoadIdentity();
          gl.Translate(0.0f, 0.0f, -6.0f);
  
          if (!draw) return;
  
          bool drawElements = false;
  
          if (drawElements)
          {
              gl.Begin(OpenGL.TRIANGLES);
  
              for (int i = 0; i &lt; elementNo; i++)
              {
                  for (int j = 0; j &lt; 3; j++)
                  {
                      float x, y, t;
                      x = nodesN[elements[i, j], 0];
                      y = nodesN[elements[i, j], 1];
                      t = nodesN[elements[i, j], 2];
  
                      gl.Color(t, 0.0f, 1.0f - t);
                      gl.Vertex(x, y, 0.0f);
                  }
              }
  
              gl.End();
          }
  
          gl.Color(0f, 0f, 0f);            
  
          gl.Begin(OpenGL.LINES);
  
          //for(int i=edges.Count-1; i&gt;=0; i--)
          for(int i=0; i&lt;edges.Count; i++)
          {               
  
              float x1, y1, x2, y2;
              x1 = nodesN[edges[i].First, 0];
              y1 = nodesN[edges[i].First, 1];
  
              x2 = nodesN[edges[i].Second, 0];
              y2 = nodesN[edges[i].Second, 1];
  
              gl.Vertex(x1, y1, 0.0f);
              gl.Vertex(x2, y2, 0.0f);                
          }   
  
          gl.End();          
      }
  </code></pre>
  
  <p>But it doesn't draw all the edges. If i change <code>drawElements</code> it draws different number of edges. Changing <code>for(int i=0; i&lt;edges.Count; i++)</code> to <code>for(int i=edges.Count-1; i&gt;=0; i--)</code> shows that esges are generated correctly, but they are not drawn.</p>
  
  <p>Images:<br>
  <code>for(int i=0; i&lt;edges.Count; i++)</code><br>
  <code>drawElements=false</code><br>
  <a href="http://img225.imageshack.us/img225/9295/noup.jpg" rel="nofollow noreferrer">http://img225.imageshack.us/img225/9295/noup.jpg</a></p>
  
  <p><code>for(int i=edges.Count-1; i&gt;=0; i--)</code><br>
  <code>drawElements=false</code><br>
  <a href="http://img828.imageshack.us/img828/9595/nodown.jpg" rel="nofollow noreferrer">http://img828.imageshack.us/img828/9595/nodown.jpg</a></p>
  
  <p><code>for(int i=0; i&lt;edges.Count; i++)</code><br>
  <code>drawElements=true</code><br>
  <a href="http://img64.imageshack.us/img64/4929/withup.jpg" rel="nofollow noreferrer">http://img64.imageshack.us/img64/4929/withup.jpg</a></p>
  
  <p><code>for(int i=edges.Count-1; i&gt;=0; i--)</code><br>
  <code>drawElements=true</code><br>
  <a href="http://img833.imageshack.us/img833/9167/withdown.jpg" rel="nofollow noreferrer">http://img833.imageshack.us/img833/9167/withdown.jpg</a></p>
  
  <p>What is wrong with this? How can I draw all edges?</p>
  
  <p><strong>EDIT:</strong><br>
  Never mind, I dropped SharpGL and wrote exactly the same code in OpenTK. It works excelent without me wondering what was wrong. This was a good call because SharpGL uses enormously big amount of memory.</p>