Zooming

Hello guys!

I need to implement a zoom window in my application, but I don’t know how to do this can someone show me …

Thank you for the moment

Best regards

Kurt

PS.: It is really important, it will save my life.

You if you are using gluPerspective to setup the projection matrix, you just call it again but now with a smaller fov.

If you are using glFrustum/glOrtho, just make the frustum smaller, i.e. the l, r, b and t argument smaller while keeping the near and far.

Just don’t forget to enable the projection matrix and load the identity first.

Save your life? Someone got a gun to your head over the matter?

Seriously, what exactly do you mean?

Do you want to zoom in your whole window? if so, then just scale the FOV angle accordingly. If you are using gluPerspective, the FOV is the 1st parameter.

Do you want a small, secondary, zoomed-in window to appear in a sub section of your screen (similar to how some driving games do rear view mirrors)? If so, then use glViewport to specify a subregion of the window and then set all the matricies appropriately and use the technique described above for your subwindow

[This message has been edited by LordKronos (edited 09-15-2000).]

Ok guys!!

Thank you very much, but I really don’t know how to do this, the only think that I have is the corners of the rectangle, how can I use this data to make the zoom ???

Thank you for the moment

Best regards

Kurt

Do you mean the corners of ya screen rectangle or of your frustrum? If you mean the screen rectangle this piece of code will help you: glViewport(x,y,width,height) then do your zoomed drawing here. Finally set the viewport back to your window size glViewport(x,y,wndWidth,wndheight);
If you mean the rectangle of your frustrum ist just as easy as above. Make a call to gluPerspective(field of view, wndWidth/wndHeight, near, far clipping plane). x,y is the upper-left position of your viewport, wndWidthHeight declare themselves, field of view is for example 15 or 20. For a higher zoomfactor just decrease this value. I think near and far clipping plane should be known to you. Perhaps it helps you. But weird…

Dear Nitro,

Now I think that I understand the problem.

Thank you very much

Best regards

Kurt