How to zoom...!

Started by
8 comments, last by Halloko 22 years, 3 months ago
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
Advertisement
Dont know what the engine in that book is ,but maybe if possible you can change your FOV.
Sounds fair enough...;-)
I''ll try that..;-)
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!!!
WHO DID YOU EXPECT...?MAYBE SATIN!!!
Ever consider simply moving the camera closer?

Jonathan
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.
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
yep set the projection matrix to identity and use either gluPerspective or glFrustrum.

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.

WOW.. thanx validus.. the code you showed WORKS..;-)

Thanx m8..

Halloko

This topic is closed to new replies.

Advertisement