View Full Version : Processing mouse wheel actions?
10-14-2008, 02:06 PM
Is there any way to process mouse wheel input with GLUT?
THe rotation, not mousewheel clicks :D
10-14-2008, 02:40 PM
There is the glutMouseWheelFunc (http://openglut.sourceforge.net/group__input.html).
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>.
10-14-2008, 02:42 PM
No way to use it in all implementations?
I want my code to stay platform-independant :p
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... :p
10-14-2008, 02:55 PM
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.
10-15-2008, 01:42 AM
And anyway freeglut is multiplateform.
The original glut is 10 YEARS old.
04-15-2010, 09:41 AM
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 :
MOUSE_LEFT_BUTTON = 0,
MOUSE_MIDDLE_BUTTON = 1,
MOUSE_RIGHT_BUTTON = 2,
MOUSE_SCROLL_UP = 3,
MOUSE_SCROLL_DOWN = 4
Hope this can help someone! Cheers,
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.