View Full Version : How can i use mouse middle up-down button
12-28-2011, 01:27 PM
I know GLUT_MIDDLE_BUTTON.
But i want to use up and down controls in mouse's middle button
12-28-2011, 01:41 PM
Do you mean the mouse wheel? There is glutMouseWheelFunc() (http://linux.die.net/man/3/glutmousewheelfunc), but the linked man page lists some caveats.
Mouse wheel motion should be reported as clicks of different buttons by glut. Have you tried simply printing the value of "button" that is passed to your glutMouseFunc() callback when you move the wheel?
12-28-2011, 02:09 PM
Yes mouse wheel.I use dev-c++.And i take this linker error:
[Linker error] undefined reference to `glutMouseWheelFunc'
Is this a std method for opengl?I looked glutMouseWheelFunc in internet.Needs openglut.h library.I tried with glut.h library.Which must i use lib for glutMouseWheelFunc in dev-c++?
12-28-2011, 02:34 PM
You do have glutMouseWheelFunc with freeglut. The original glut did not support a mouse wheel, so be sure to link against freeglut and not venerable glut.
12-28-2011, 02:34 PM
Is this a std method for opengl?
No, it is not part of OpenGL, it is part of glut, which is a library that makes writing simple, portable OpenGL programs relatively easy - probably it's primary use is for learning OpenGL and/or writing tutorials though.
Anyway, there are a number of implementations of "glut", openglut (http://openglut.sourceforge.net/) and freeglut (http://freeglut.sourceforge.net/) are popular choices.
Some of these implementations add extra functionality, it's quite possible that glutMouseWheelFunc() is such extra functionality that is not supported by the glut you have.
You have basically two options:
- see if you can get things to work with glutMouseFunc() alone - have you tried what I suggested earlier?
- download, build and install a different glut implementation
12-29-2011, 03:40 AM
I can also recommend using http://www.glfw.org/ instead of glut. I think it is a more modern library than the glut family, and more flexible.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.