title: How to move vertices in opengl
body: <p>Hi i wrote a program to create polygons. In my program you can click in two or more areas and my program connects the 1st point with the 2nd, the 2nd with the 3rd etc. If i do a right click then the last point will be connected with the first point and then my polygon is ready. Now i want to move a vertex of my polygon. something like drag and drop. I started writing this code:</p>
  
  <pre><code>    void move(GLint button, GLint action, GLint xPosition, GLint yPosition){
          screenCoordinates newCoord;
          if (button == GLUT_LEFT_BUTTON &amp;&amp; action == GLUT_UP) {
              for (int i = 0; i &lt;= position; i++){
                  if ((xPosition == vertexCoord[0][position] + 5 || xPosition == vertexCoord[0][position] - 5) &amp;&amp; ((yPosition == vertexCoord[1][position] + 5 || yPosition == vertexCoord[1][position] - 5)))
                      //....
              }
  
  
  }
  }
  </code></pre>
  
  <p>i have +-5 because it is difficult to click exactly in a vertex.I also have an array with all vertices(vertexCoord[2][200]). Now how can i move my vertex ?</p>