-
glLookAt problem
Hi Everybody, I have a small problem.
I am using gluLookAt in with keyboard char 'f' so when i press the 'f' key the camera zooms towards the object its meant to zoom until it can go no more, when it reaches the end the camera returns to its original position.
My problem is I have previously done this code and it worked fine, I had it commented out for a while until I completed everything else and for some reason now its not working at all.
Here is my relevant code:
gluPerspective(45.0f, fAspect, 1.0, 600.0);
GLfloat eyePosition = 500.0;//default position
void normalKeys(unsigned char key, int x, int y)
{
if (key == 'f')
{
eyePosition = eyePosition - 100.0;
glutPostRedisplay();
}
}
void RenderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode (GL_MODELVIEW);
glPushMatrix();
glTranslatef(0.0f, 0.0f, -100.0f);
gluLookAt(0.00,0.00,eyePosition,
0.00,0.00,0.00,//centre
0.00,1.00,0.00);//up
glLoadIdentity();
/* DRAWING CODE HERE */
glFlush(); //execute drawing commands in buffer
glutSwapBuffers();
}
Last edited by donmitz; 01-06-2013 at 11:08 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules