Article

# True OpenGL Zooming

By , 11 Feb 2002
 Rate this:
Please Sign up or sign in to vote.

## Introduction

The topic of this article is focused around zooming in a perspective OpenGL view. I wrote this article because I found some examples of zooming in a OpenGL view using ortho projections. But the most advanced example that I found using perspective projections, don't implement a true zooming but simulate the zooming effect changing the view point or camera angle. The technique that I suggest implement a true zooming and not change camera angle or perspective parameters (view point, reference point clipping planes). I achieved this result using the function `glFrustum` instead of standard `gluPerspective` and manipulating (see function `COGL::SetPerspective(const CRect &rcClient)` in the class `COGL`) the scaling and translating parameters of projection matrix. Two normalized rectangles are maintained by the `COGL` class: one for the full size image, and one for the current zooming rectangle. The image presented by OpenGL is scaled by the ratio of the rectangles, adjusted according to the viewport aspect and translated to the center of current zooming rectangle.

Finally sorry for my poor English.

## License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

## About the Author

No Biography provided

## Comments and Discussions

 View All Threads First Prev Next
 Small question about OpenGL Anonymous 28-May-02 0:05
 Hi all, here is the small trouble of a new-comer to OpenGL. Who knows how to convert a 3D point to a normal point (screen coordinate) and how to do on the contrary. For example: CRect rc; GetClientRect(rc); int x, y; double u, v, t;   // And how to do this // 1. M1(1.0, -0.7, 2.3) --> M2(x, y) ; // 1. M2(100, 120) --> M1(u, v, t); // where x in [rect.left, rect.right] and y in [rect.top, rect.bottom] By the way, who can tell me how to load the current matrix to an array (double mymatrix[16]). Please help me. Thanks for your care
 Re: Small question about OpenGL Ali Khanlarkhani 19-Jan-03 0:33
 Last Visit: 31-Dec-99 18:00     Last Update: 17-Apr-14 16:13 Refresh 1

General    News    Suggestion    Question    Bug    Answer    Joke    Rant    Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 12 Feb 2002
Article Copyright 2002 by pepito sbarzeguti
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid