Zooming, panning, rotating with GLUT
Tags: software
By pure chance, I stumbled over a true gem for all programming related to computer graphics: GLT ZPR, a mouse manipulation module for C or C++ GLUT/OpenGL programs (verbatim quote).
The module is very easy to use: Simply #include "zpr.h"
and call zprInit();
after you called glutCreateWindow
and have made your local initializations (i.e. special setup for the window etc.). Now you are able to use the left, right, and middle mouse buttons to rotate, pan, and zoom—just make sure that your GL_MODELVIEW
matrix is not reset.
You can download the program from Nigel Stewart’s homepage (I am not linking directly to the sources because I do not want to be impolite). By the way: It is also possible to specify selection and pick functions, but I have not tried this functionality yet.