PDA

View Full Version : beginner wants to zoom



link19
01-05-2001, 09:51 AM
Hi all
i have drawn a graph. i want zoom functionality on the mouse click. any hints/clues/sample apps would be greatly appreciated.

zed
01-05-2001, 01:08 PM
make the graph bigger.
using a perspective projection u can use a smaller FOV.
with an orthogonal projection use glScale.(...)

link19
01-08-2001, 08:39 AM
Youre speaking greek...Im too new at this. What is FOV and please explain how making the graph bigger accomplishes my goal?

grady
01-08-2001, 10:32 AM
void ChangeSize(GLsizei w, GLsizei h)
{
if(h==0)
h=1;
glViewport(0,0,w,h);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

GLfloat aspect=(GLfloat(w)/GLfloat(h));

gluPerspective(15.0, aspect, 0.01, 500.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
-------------------------
the value 25.0 in the gluPerspective(); is the field of view. if it shrinks then the scene looks like it zooms in.

[This message has been edited by grady (edited 01-08-2001).]

link19
01-08-2001, 11:29 AM
Thanx...works like a charm