Sign in to follow this  

Mouse scroll wheel (glut)

This topic is 2636 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
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

This topic is 2636 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this