Archived

This topic is now archived and is closed to further replies.

Halloko

How to zoom...!

Recommended Posts

Halloko    122
Hi.. I''ve just finished reading the GREAT book called "OpenGL Game Programming"... And now I''ve started to take a closer look at the 3D-engine presented in the book... I''ve tried to add some kind of zoom-function... but it''s kinda difficult I think... How could one make the camera zoom in and stay there..??? I know this is a weird question... just wanted to hear if anyone had some brilliant ideas..;-) Thanx..Halloko

Share this post


Link to post
Share on other sites
RELOAD    122
Hey i read that same book but i am having some trouble with the terrain example. Just wondering how you thought the terrain engine worked?


WHO DID YOU EXPECT...?
MAYBE SATIN!!!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Jonathan, moving the camera closer changes the znear and zfar positions... Changing the fov keeps the camera in it''s correct position and simply makes the frustrum smaller hence viewing a smaller area, whilst keeping the same screen size. A "real" zoom.

Share this post


Link to post
Share on other sites
Halloko    122
reload-> Do u mean the Heightfield Terrain Example?? Or the terrain used in the engine in the end of the book??

Anonymous-> If I change my FOV and make it smaller how on earth can it then be a "real" zoom?? Of course if I simply move the camera closer I will get some collision detection problems but changing the FOV sounds like a good idea..! Just how would one do that? make a call to glFrustrum()/glPerspective() ??

BTW.. thanx for all your replys everybody
Halloko

Edited by - Halloko on January 2, 2002 4:25:03 AM

Share this post


Link to post
Share on other sites
Validus    122
Hi,
you could try this it is prity much what someone eles sugested about changin the FOV

  
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(cos(tempAng += 0.03) * 10 + 33, 640.0/480.0, 1.0, 3000.0);
glMatrixMode(GL_MODELVIEW);


you ues tempAng to zoom in and out.
This is frome another exelent book "Game Progamming Gems", and I have uesed it in my apps and it dose work very well.

Share this post


Link to post
Share on other sites