It works sort of. I am getting the normal + or -120 when I flip the mouse wheel, but I only get it SOMETIMES. I am not sure when the WM_MOUSEWHEEL message is getting deleted, but it must be. I am calling the above function in the glutDisplayFunc, and all the glutMouseFuncts (mouse motion, passive motion, and the main mouse one). It works like 50% of the time, half the time when I flip the wheel I get a message, and usually only if I flip it REALLY FAST. If I only call it in the displayFunc, it works like 10% of the time, and if I only call it in all the combined mouse functions, it works 40% of the time…
Also, it works 100% of the time, perfectly, as long as I am actually MOVING the mouse, how strange.
Does anyone have a clue as to what I should do?
–Joseph
[This message has been edited by Joseph19 (edited 08-15-2003).]
Mmm, the only reason one would use GLUT for an application is that it’s platform independent - what you’re doing is making it platform dependent. You appear to have a more than passing knowledge of the windows message pump, so why don’t you just write your own glut? Wouldn’t take more than half a day to get something equal to GLUT.
Are you using windows? Are you using the normal version of GLUT? I found one that has a hacked mouse callback but I need to use the normal one right now, for reasons too boring to mention.
Originally posted by virtualchetan:
[b]I think best way to use Mouse Wheel and GLUT is : look for button values 3(Wheel Up) and 4 (Wheel Down) in the mouse press callback.
(GLUT_LEFT_BUTTON = 0, GLUT_RIGHT_BUTTON = 1, GLUT_MIDDLE_BUTTON = 2, and 3,4 for wheel)
Chetan[/b]
I believe that is an XFree86 (Linux) only solution. My guess is that GLUT does not know about the mousewheel, nor buttons 4 & 5, it simply passes the button no. from the X event to the GLUT callback. Since buttons 4 & 5 are usually mapped to the mousewheel (up/down), at least under XFree86, you can get away with your proposed solution (provided that you are running under the right environment).
As Ozzy mentioned, GLFW has support for the mousewheel, both under Windows and under X. GLFW is currently closing in (and sometimes surpasing) GLUT in terms of portability, so it might not be a bad alternative (the obvious recommendation of an author ).