Skip to main content
gamedev.net
🔒 Locked

mouse scroll

Started by tinu 0 replies 2.7k views
Original Post
tinu
tinu
Hi, I want to know How to handle mouse scroll in OpenGL using glut. When I browsed in net, I got a glut patch that claims it handles Mouse scroll. the link is : http://www.realmtech.net/opengl/glut.php I used the following code in glut callback function for mouse click if (state == GLUT_UP ) { if ( button == GLUT_WHEEL_UP ) { printf("Wheel Up\n"); } else if( button == GLUT_WHEEL_DOWN ) { printf("Wheel Down\n"); } } But this does not display the message when mouse is scrolled... Is there any other way.... Thanks in advance....
polymorphed
polymorphed
Well the other method would be using WinAPI.
I have never actually used GLUT myself, so I don't know how it works, and how hard it is to "go around" the GLUT functions and use straight WinAPI instead.
But here are the WinAPI functions relating to the mouse:

Here's an overview of the different mouse messages you can receive

Here's info about WM_MOUSEWHEEL

So what you need to do is add code to handle WM_MOUSEWHEEL messages in your window procedure.
while (tired) DrinkCoffee();

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.