How to add a zoom function

Hello everyone,
I am looking for an easy way to zoom on a part of a scene. For the moment I use gluPickMatrix() to give the part of the window I want my zoom on and then I call gluPerspective(). The problem is I don’t get my zoom on the rectangle I was hoping, it goes somewhere else…
So I would like to know if it is a (good) way to do it or not and if not, can everyone give me another method…I can’t find examples on the web.
Thank you for your help :slight_smile:

You can just change the field of view parameter in your perspective projection.


Yes I have seen this easy way, thank you for your reply. But at the moment I can select a box to zoom on so I would like to zoom exactly on this box, with gluPerspective I will zoom on the center point (right?), not exactly on my box…I can try to put the center of my box in the middle of the viewport and then zoom…No?
If anyone knows how I could achieve that simply…thank you to let me know :slight_smile:

Use a combination of gluLookAt, and fov.