title: OpenGL - drawing polygon on mouse click, polygon is always on to the right
body: <p>For one of my classes I'm creating a simple paint program with OpenGL and one of the first steps is to make a left mouseclick create a polygon on the window. I get it to draw it but the polygon always ends up about a third across the window to the right of the position where I click</p>
  
  <p>My mouseclick code is ...</p>
  
  <pre><code>//function called when mouse is clicked
  void mouseClick(int button, int state, int x, int y){
  
      float ptr1[3] = { x-size, y-size, 0 };
      float ptr2[3] = { x-size, y+size, 0 };
      float ptr3[3] = { x+size, y+size, 0 };
      float ptr4[3] = { x+size, y-size, 0 };
  
    if( button == GLUT_LEFT_BUTTON &amp;&amp; state == GLUT_DOWN){//if the left mouse button     is     clicked   
      glColor3f ( 1.0, 1.0, 1.0); //set color to white ( remove later)
      glOrtho (0.0, 1.0, 0.0, 1.0, -1.0, 1.0); //sets the window coordinates?
      glBegin (GL_POLYGON); //start drawing a polygon
               glVertex3fv (ptr1);
       glVertex3fv (ptr2);
       glVertex3fv (ptr3);
       glVertex3fv (ptr4);
  glEnd();
      glFlush(); //flushes all commands to ensure polygon is drawn
    }
    //glutPostRedisplay( );
  }
  </code></pre>
  
  <p>Can anyone see any obvious faults? Size is a float = to 32 but I feel like that's irrelevant to this problem.</p>