title: Glut Mouse Coordinates
body: <p>I am trying to obtain the Cartesian coordinates of a point for that I am using a simple function the devolves a window coordinates, something like (100,200). I want to convert this to Cartesian coordinates, the problems is that the window size is variable so I really don't know how to implement this.</p>
  
  <p>Edit:</p>
  
  <p>Op:</p>
  
  <p>I tried to use the guUnPorject by doing something like this</p>
  
  <pre><code>GLdouble modelMatrix[16];
  glGetDoublev(GL_MODELVIEW_MATRIX,modelMatrix);
  GLdouble projMatrix[16];
  glGetDoublev(GL_PROJECTION_MATRIX,projMatrix);
  
  
  double position[3];
   gluUnProject(
    x,
     y,
    1,
   modelMatrix,
   projMatrix,
   viewport,
   &amp;position[0], //-&amp;gt; pointer to your own position (optional)
   &amp;position[1], // id
   &amp;position[2] // 
   );
  
   cout&lt;&lt;position[0];
  </code></pre>
  
  <p>However the position I got seems completely random</p>