PDA

View Full Version : pan and zoom window



glCAD
01-27-2004, 10:35 AM
I have a 3D scene and I want to move my scene preserving the current angle and continue operations(zoom, rotation etc) in new view. I am using gluPerspective and it seems to me like I need to translate along the line defining the axis on screen plane and I need the position of eye to calculate that translation axis. I feel I will have the same problem if I try to use a zoom window. How can I get the eye position? or how can I do this pan/zoom window operation? Does anyone know?

dorbie
01-29-2004, 05:50 AM
The translate you require along the x axis can actually be applied directly to the matrix along the x axis provided you apply it at the correct time. If you apply it as a post multiply on the modelview then the vector will have to be transformed through the modelview to eye space to be correct, but a premultiply of the x axis translate on the modelview (i.e. do it first) would translate in eye space and give you a sidle motion.

glCAD
01-29-2004, 01:14 PM
I added glTranslated(panX,0,0); to the first line of my drawing function(after glclear and glloadidentity). It almost does what I want but there happens a little rotation around the y axis of screen which is like object is moving in front of me through screen x axis in which i am staying stationary. The thing I exactly want is I want my eye to move with the object so that I do not feel any rotation. Like scrolling the scene. Thank you so much. Please help me if you know also the answer to this problem.


Originally posted by dorbie:
The translate you require along the x axis can actually be applied directly to the matrix along the x axis provided you apply it at the correct time. If you apply it as a post multiply on the modelview then the vector will have to be transformed through the modelview to eye space to be correct, but a premultiply of the x axis translate on the modelview (i.e. do it first) would translate in eye space and give you a sidle motion.