Jump to content
  • Advertisement
Sign in to follow this  
FooLeo

Mouse scroll wheel (glut)

This topic is 2852 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, so I am trying to utilize the scroll wheel of the mouse in my program. here is my code:

void mouse(int button, int state, int x, int y)
{
cout<< "It's Happening" << endl;

if (state == GLUT_UP )
{
if ( button == GLUT_WHEEL_UP )
{
cout<< "Wheel Up" << endl;
gameCamera.zoom(GLUT_WHEEL_UP);
}
else if( button == GLUT_WHEEL_DOWN )
{
cout << "Wheel Down" << endl;
gameCamera.zoom(GLUT_WHEEL_DOWN);
}
}
}

The function is called ("It's happening is printed") whenever i click and what not, but it does nothing when I try to scroll. Is there a way to use scrolling with glut? if not, what is another option? It'd be nice if I didn't have to include another library or anything.

As a not i've defined

#if !defined(GLUT_WHEEL_UP)
# define GLUT_WHEEL_UP 3
# define GLUT_WHEEL_DOWN 4
#endif

at the top of the program. But it doesnt really matter because the function isn't even calling then you scroll at all.


Share this post


Link to post
Share on other sites
Advertisement
Hello,

I use freeglut on linux and find that it doesn't support scroll wheel.
There is no define of GLUT_WHEEL_UP and GLUT_WHEEL_DOWN.
So try other libraries such as SDL, SFML and QT.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!