glfwGetMousePos

cengkarim wrote on Thursday, April 21, 2011:

I found something strange, may be I’m doing something wrong. When my OpenGL
application starts running, I query the mouse coordinates, they just 0, 0.
After the first move of the mouse, the coordinates just jumps to
windowWidth/2, windowHeight/2 (I guess). I this normal? The problem is I use
the mouse to rotate the camera, and as expected, the camera just flips around
on the first move of the mouse and I have to realign it again. Here is my
initialization code:

void initializeApplication ( void )
 {
      ...
      glfwPollEvents ();
      glfwGetMousePos ( & mousePreviousX, & mousePreviousY );
      cout << mousePreviousX << "," << mousePreviousY << endl;
      ...
}
void draw ( void )
{
      ...
      glfwGetMousePos ( & mouseCurrentX, & mouseCurrentY );
      cout << mouseCurrentX << "," << mouseCurrentY << endl;
      ...
      glfwSwapBuffers ();
}

Here is the output:

...
0,0
0,0
0,0
0,0
0,0
0,0
322,115
326,121
329,123
330,123
...

Any clues?
Thanks