Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / Zooming in a 3d editor (???) Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Vast

February 17, 2005, 05:31 PM

How would i do it? I just dont understand...

Say, i want to do zooming, like in a 3d editor, where the object is getting closed, but is not translated towards the user.

Can anyone help me? (im using ogl)

Tim

 
I'M BRIAN FELLOWS

February 17, 2005, 05:39 PM

SMALLER FIELD OF VIEW.

 
Vast

February 17, 2005, 05:58 PM

What if it's ortho?

 
Samuel Hornus

February 17, 2005, 06:16 PM

TIGHTER LEFT, TOP, RIGHT, BOTTOM IN GLORTHO

 
Vast

February 17, 2005, 06:49 PM

Hornus, what do you mean by tighter?

Tim

 
Victor Widell

February 17, 2005, 07:16 PM

Closer to eachother.

When the frustum is more narrow, the things seen through it will be bigger, relative to the frustum. Meditate over this for a while.

 
theAntiELVIS

February 17, 2005, 07:18 PM

You could just move the camera viewpoint closer - that in combination with a smaller Field-Of-View angle if you are using a wide FOV (greater than 80 degrees or-so).

 
Vast

February 17, 2005, 08:51 PM

I found it out!!

There is an easier way! Since everything is in an ortho view, i need to ignore the Z-axis, and therfore, i can just Scale stuff with just X,Y values, and leave the z value alone. That should create an illusion of magnification, yes?

AntiElvis, if i move the camera in the z-direction, it might interfere with the geometry, and therefore cause some artifacts, and missing faces and such.
Also as far as i know, u can not change a FOV in ortho. BUT that could be useful if i want to do the same in perspective.

Thanks a lot everyone!
Tim

 
juhnu

February 17, 2005, 10:24 PM

it's all about how you set your projection matrix. you don't need to touch view or world matrices at all.


juhani

 
Samuel Hornus

February 21, 2005, 07:31 PM

Sure this is a solution, but an ugly one.
I assume you use glOrtho(left, right, bottom, top, near, far) to setup your projection matrix. right ?
So, if you want to zoom by a factor K, use :

f = 1.0f/K;
glOrtho(f*left, f*right, f*bottom, f*top, near, far);

*This* is much more elegant and safer and wiser than your solution.
--
Samuel

 
Vast

February 21, 2005, 08:59 PM

Hey, thanks a lot! I *do* find your solution a lot erm "safer" so i guess ill use it. Appreciate it.

Thanks.

Tim

 
This thread contains 11 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.