PDA

View Full Version : zooming



02-16-2004, 02:07 PM
Can any one please help me out with the code that can do zooming in and out on an object?

MrShoe
02-16-2004, 02:19 PM
gluPerspective(zoom, width/height, 0.1f, 1000.0f);

lower the value of zoom (a float) to zoom in, increase the value to zoom out.
Look up the specs on gluPerspective for more info on why that zooms.

Night Hacker
02-18-2004, 03:26 PM
Just a note, that "ZOOM" value is actually your "field of view", which you may recognize from some games like Quake. A normal FOV value varies but some good numbers between 45 to 60 make a nice normal view. If you want to be able to zoom in when a player presses a key for example, you could gradually lower than value down to 10 when a key is pressed and it will appear to zoom in (smaller field of view), and then of course, just raise that value back up to your normal FOV when the key is released if that is what you like.