I am trying to make a simple program that will zoom, pan, and rotate around a scene using the mouse. It seems natural to use gluLookAt to do this since I want to move the camera. I got zooming to work (using gluPerspective), but I dont know how to smoothly rotate or pan?
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective (50.0*ViewingFrustrum.zoom, ViewingFrustrum.aspect(), ViewingFrustrum.zNear, ViewingFrustrum.zFar);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 10, 10, 0, 0, 0, 0, 1, -1); // eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz
Then to zoom, I handle a middle mouse hold+move which does this
ViewingFrustrum.zoom += increment;
That is very easy because the zoom does not depend on the location. However, the pan and rotate are location dependent. Is there an easy way to modify this so that left mouse will rotate?
Thanks,
Dave