Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Zoom window in Perspective view?

  1. #1
    Junior Member Regular Contributor
    Join Date
    Dec 2002
    Posts
    121

    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.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Zoom window in Perspective view?

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2006
    Posts
    11

    Re: Zoom window in Perspective view?

    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.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Dec 2002
    Posts
    121

    Re: Zoom window in Perspective view?

    Anyway, I have found the solution. Thanks everyone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •