0

Possible Duplicate:
Using the mouse scrollwheel in GLUT

Like the title says, how do you achieve this in Glut ?

Community
  • 1
  • 1
Jonas
  • 1,019
  • 4
  • 20
  • 33
  • Consider moving to glfw instead. GLUT is very old and supports deprecated OpenGL. I can't understand why it is used at all? – Lars Pensjö Jul 30 '12 at 04:11

1 Answers1

1

The scrollwheel usually shows up as two mouse buttons glut, so you can track the scrollwheel with glutMouseFunc tracking the appropriate mouse events. The tricky part is figuring out WHICH mouse buttons correspond to the scrollwheel. You can use glutDeviceGet(GLUT_NUM_MOUSE_BUTTONS) to find out how many buttons the mouse device supports and guess based on that, but its probably best to make this configurable in your program by asking the user to twiddle the scrollwheel and see which button events you get back.

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226
  • By convention vertical mouse wheel is buttons 4 and 5, horizontal is 6 and 7. All additional, real mouse buttons are 8 and onwards. – datenwolf Jul 29 '12 at 22:33