I am having mouse problems, I want to read the position of the mouse releative to the screen “(-5, -5), (5, 5) screen size in gl units”. I the code looks to be correct, but I get wierd error’s. divid by zero, or it does not work at all.

If you get a division by zero, you probably have Win_x and Win_y set to zero.

If Win_x and Win_y are integers, you are doing integer division, since x and y are also integers. Integer division is not the same as “normal” division. Try to typecast the integer variables to float or double before dividing. Like this.

I assigned all my mouse variables to float’s and that fixed the problem…

Originally posted by Bob:
[b]If you get a division by zero, you probably have Win_x and Win_y set to zero.

If Win_x and Win_y are integers, you are doing integer division, since x and y are also integers. Integer division is not the same as “normal” division. Try to typecast the integer variables to float or double before dividing. Like this.