12,626,813 members (35,252 online)
alternative version

233K views
63 bookmarked
Posted

# True OpenGL Zooming

, 11 Feb 2002
 Rate this:
True zooming on a perspective view...

## 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.

A list of licenses authors might use can be found here

## Share

 Italy
No Biography provided

## You may also be interested in...

 Pro

 View All Threads First Prev Next
 Small question about OpenGL Anonymous28-May-02 1:05 Anonymous 28-May-02 1: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 Khanlarkhani19-Jan-03 1:33 Ali Khanlarkhani 19-Jan-03 1:33
 Last Visit: 31-Dec-99 19:00     Last Update: 5-Dec-16 21:20 Refresh 1