1

recently i have been programming a simple program on C++ and GLUT and i wanted to use the scroll wheel for some rotation speed increase/decrease. I have found out that scroll wheel generates 3/4 callback ( 3 for scroll up 4 for scroll down ). My problem is that on windows i get no callback at all! left right and middle mouse click generate 0,1 and 2 but scroll wheel nothing. ( I work on Visual Studio 2015 and Windows 10) On my Ubuntu system with the same libraries scroll wheel generates the callbacks just fine but on windows nothing. here is the code that i use on glutMouseFunc()

void setRotationSpeed(int button, int dir, int x, int y)
{
    printf("button is %d\n", button);
    if (button == 3)
    {
        rotationSpeed += 0.1;
    }
    if (button == 4)
    {
        if (rotationSpeed > 0.0)
            rotationSpeed -= 0.1;
    }
}

I have searched without any luck. At first i thought that maybe the libraries i use had problem but then i took the ones that i used on Ubuntu and i had the same problem so if anyone has something to suggest i would be very gratefull!

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Fotis
  • 97
  • 2
  • 13
  • Possible duplicate of [Using the mouse scrollwheel in GLUT](http://stackoverflow.com/questions/14378/using-the-mouse-scrollwheel-in-glut) – BDL Dec 30 '15 at 23:54
  • 1
    @BDL: How exactly is this a duplicate? He's not asking how to do it; he's saying that he did that and it didn't work. – Nicol Bolas Dec 31 '15 at 02:37
  • Sorry for not responding earlier...tough day (making preparations for new Years eve ) @BDL yes i had already read that article and tried both ways but i still didn't got any callback from the mouse wheel ( according the if's and the printf that i have on my function ) Also a friend of mine that has a mac has the same issue as me...no callback from the mouse wheel...only on ubuntu the mouse wheel was working as it supposed to. :/ – Fotis Dec 31 '15 at 11:18

1 Answers1

0

Unfortunately it is not guaranteed that glutMouseFunc will emit callback for wheel action, check GLUT spec, the fact that it's working on Linux is out of GLUT specification. I think that previously there was something like glutMouseWheelFunc, now there is no option to get any callback about wheel which is not implementation specific. You can still try to use FreeGLUT library, it is newer and also cross-platform, for sure wheel actions are implemented. Good luck.

Marek Kijo
  • 173
  • 1
  • 9
  • I did use the freeglut library but without any luck. Still no response when i use the mouse wheel. I believe it has something to do with the operating system and not with the libraries. Thanks though – Fotis Jan 03 '16 at 00:22