View Full Version : Zoom window in Perspective view?
11-14-2006, 07:11 PM
I would like to know how to implement a zoom window in a perspective view. Say I have a first window coordinate at C1(X1,Y1) and second window coordinate at C2(X2,Y2) that form a region.
My question is
1)How to transform the selected region to the center of the view?
2)How to scale the region to fit the current viewport?
Thanks for any reply.
11-16-2006, 12:04 AM
I suggest to have a look at glFrustum, you can use that instead of gluPerspective, you would have to do some math to calculate the correct values but it's not that difficult to do.
11-16-2006, 06:28 PM
i think an easy way of doing this is to save the currect projection matrix (M), then create a matrix to do the apropriate mapping(A), and then make the projection matrix A times M.
you can create A just by asuming your transforming the screen.
for example, if you want the top right fourth of the current viewport, you save the current matrix, do loadidentity() scale(.5, .5, 1) translate(1, 1, 0);
then just multiply this new matrix by the one you had saved.
11-19-2006, 04:41 PM
Anyway, I have found the solution. Thanks everyone.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.