Zoom window in Perspective view?

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.

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.

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.

Anyway, I have found the solution. Thanks everyone.