Click here to Skip to main content
11,413,676 members (76,664 online)
Click here to Skip to main content

True OpenGL Zooming

, 11 Feb 2002
Rate this:
Please Sign up or sign in to vote.
True zooming on a perspective view...

Sample Image - Zoom.jpg

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

Share

About the Author

No Biography provided

Comments and Discussions

 
GeneralAbout 3D point Pin
Eduardo Tucci, 29-Jun-10 16:54
memberEduardo Tucci29-Jun-10 16:54 
QuestionPanning in perspective view? Pin
Han Wu, 17-Nov-06 6:27
memberHan Wu17-Nov-06 6:27 
Generali want to use 3dmax , opengl and c# Pin
eey56, 30-Oct-06 22:53
membereey5630-Oct-06 22:53 
Generalopengl control ... Pin
doudicool, 5-May-06 12:34
memberdoudicool5-May-06 12:34 
GeneralAdd Scroll Bar Pin
anil, 6-Sep-05 23:14
memberanil6-Sep-05 23:14 
Generalzooming Pin
sreejith ss nair, 28-Apr-05 21:24
membersreejith ss nair28-Apr-05 21:24 
QuestionHow To Load 3DMax Objects in OpenGL? Pin
obaid salikeen, 26-Apr-05 0:31
memberobaid salikeen26-Apr-05 0:31 
Generalis it possible to use it for dialogs Pin
nandeeshds, 28-Oct-04 6:05
membernandeeshds28-Oct-04 6:05 
QuestionHow to run 2 different(or same) OpenGL objects in one DialogBox? Pin
werter1, 3-May-04 22:10
memberwerter13-May-04 22:10 

How to run 2 different(or same) OpenGL objects in one DialogBox?
IDC_STATIC1 is a first OpenGL objects Scene window.
IDC_STATIC2 is a second OpenGL objects Scene window.
IDC_STATIC1 and IDC_STATIC2 ,they are placed on IDD_DIALOG1.

code:
pclStatic = (CStatic *)GetDlgItem(IDC_OpenGL_Window);
pclGlView = new CGlView(pclStatic);
pclGlView->OnCreate();
pclGlView->InitGL();
pclGlView->DrawGLScene();

pclStatic1 = (CStatic *)GetDlgItem(IDC_OpenGL_Window);
pclGlView1 = new CGlView(pclStatic1);
pclGlView1->OnCreate();
pclGlView1->InitGL();
pclGlView1->DrawGLScene();

Will not involve both windows (IDC_STATIC2,IDC_STATIC1)
QuestionHOW TO DRAW A CIRCULAR SCALE? Pin
prath, 8-Apr-03 3:46
memberprath8-Apr-03 3:46 
Questionhow to ZOOM? Pin
prath, 8-Apr-03 3:43
memberprath8-Apr-03 3:43 
General3D coordinate Pin
eddymohd, 19-Feb-03 23:24
membereddymohd19-Feb-03 23:24 
GeneralRe: 3D coordinate Pin
topus, 19-May-03 3:21
membertopus19-May-03 3:21 
GeneralRe: 3D coordinate Pin
Anonymous, 9-Jun-05 5:58
sussAnonymous9-Jun-05 5:58 
GeneralSmall question about OpenGL Pin
Anonymous, 28-May-02 1:05
memberAnonymous28-May-02 1:05 
GeneralRe: Small question about OpenGL Pin
Ali Khanlarkhani, 19-Jan-03 1:33
memberAli Khanlarkhani19-Jan-03 1:33 
GeneralHey Man Pin
Rick York, 16-Feb-02 14:09
memberRick York16-Feb-02 14:09 
GeneralAn Easier Way.... Pin
FatBuddha, 13-Feb-02 8:34
memberFatBuddha13-Feb-02 8:34 
GeneralRe: An Easier Way.... Pin
pepito sbarzeguti, 13-Feb-02 22:30
memberpepito sbarzeguti13-Feb-02 22:30 
GeneralRe: An Easier Way.... Pin
FatBuddha, 14-Feb-02 8:00
memberFatBuddha14-Feb-02 8:00 
GeneralRe: An Easier Way.... Pin
Alberto Bencivenni, 12-Dec-05 4:06
memberAlberto Bencivenni12-Dec-05 4:06 
GeneralRe: An Easier Way.... Pin
a_david123, 22-Jun-07 0:36
membera_david12322-Jun-07 0:36 
GeneralBroken link's Pin
pepito sbarzeguti, 12-Feb-02 7:36
memberpepito sbarzeguti12-Feb-02 7:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

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

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