可能重复:
在 GLUT 中使用鼠标滚轮
正如标题所说,你如何在 Glut 中实现这一点?
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.