View Full Version : questions...
I've implemented a virtual trackball for moving the scene around. I also have a rubberband zooming function using glFrustum with the appropriate x,y clipping plane values. However, when I move the trackball(scene) around and then select an area for zooming, it doesn't give the right result.
Is this coz the area being selected is still on the x,y plane? So how should I do the zooming regardless of what direction I'm looking in?
08-29-2002, 10:52 PM
the matrix that you pass with glFrustum is the new view frustum or is this matrix has to be multiplies with the previous ? in other word do you load identity matrix in the Projection matrix befor use glFrustum() ?
yes, I load the identity matrix before calling glFrustum...is that the wrong thing to do?
08-30-2002, 05:06 AM
which method do you use for retrieve clipping plane with your rubber band and do you take in account that glFrustum assum that the camera position is (0,0,0) ?
08-30-2002, 07:38 AM
If all you do is zoom, then you can turn your x/y selection into a new, narrower, field of view, using simple trig.
If you're actually using the x/y of the window in view space or world space, then you need to transform the x/y by the inverse of your modelview matrix. You also need to orient your camera using the modelview matrix -- the projection matrix should be conceptually axis aligned, else some weird effects may happen.
I basically track the mouse coords, use an overlay for the rubberband & convert the pixel values(x,y) to world coords using gluUnproject(with z=0) to pass to glFrustum. The near/far clipping planes remain the same.
I think my problem lies in the fact that the mouse coords don't take into account the z values?? When I've moved the scene using the trackball, n then drag out a rect for zooming, a different part of the scene is shown instead of the expected part. Is this coz I've not taken into account the viewing direction when I do the gluUnproject?
I don't quite understand what u mean, jwatte..could u explain in a bit more detail pls?
[This message has been edited by yaba (edited 09-01-2002).]
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.