Processing mouse wheel actions?

Hi all!
Is there any way to process mouse wheel input with GLUT?
THe rotation, not mousewheel clicks :smiley:

There is the glutMouseWheelFunc.
But I think this one is not implemented by all glut implementor. I have freeglut installed and to be able to use this function I must add the include file <GL/freeglut_ext.h> if I include <GL/glut.h> or simply one include with <GL/freeglut.h>.

No way to use it in all implementations?
I want my code to stay platform-independant :stuck_out_tongue:
Already read about that glutMouseWheelFunc and in fact I’m using it but the site I found says the mousewheel only can be used with a patched GLUT version and thats what I want to avoid… :stuck_out_tongue:

I have found a moment ago (can’t remember where) that you can enable mouse scrolling in glut using ‘3’ for scroll down and ‘4’ for scroll up.
You can then define your own enum to make it cleaner.

I may be mistaken here, but this works on linux including just the glut.h header. Not sure this is platform independent, the best way to check it out is to try.

And anyway freeglut is multiplateform.
The original glut is 10 YEARS old.


I know this post is old, but I found it very useful so I just add a little note.

I’m a beginner at OpenGL and I use it since a couple of week for my university projects. Before I upgrade from Ubuntu 9.10 Karmic to Ubuntu 10.04 Lucid, I was able to use the glutMouseWheelFunc() implemented in freeglut. Since then, I still can compile my programs but glutMousWheelFunc() seems to have no effect.

So, dletozeun’s solution was very helpful! You can define the following enumeration and just use it in the glutMouseFunc() callback function :


Hope this can help someone! Cheers,