How to get relative mouse coordinates when GLUT return absolute
I've just been trying to add mouse input to my 3D world, but I've been running into some problems with GLUT mouse input. When I used to use DirectInput, it let you choose the option of returning relative coordinates, so if you wanted to compute player position, you could do something like this:
Code:
Player.x += iAmountMoved.x;
Player.y += iAmountMoved.y;
However, when GLUT returns mouse coordinates, they are in absoloute coordinates, whithin the range of the user's screen res. So I thought, "No problem; I can just subtract the previous location of the mouse to get relative coordinates."
But of course I didn't think of the problem that I get when the mouse reaches the screen's edge. So my mouse-input method only works as long as the mouse is not at the edge of the screen. Not very practical for a FPS.
So now what? Is there a way to request relative coordinates from GLUT, or should I just scrap this idea and start over using something more flexible, like SDL?