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;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTranslatef(0.0f, 0.0f, -100.0f);
/* DRAWING CODE HERE */
glFlush(); //execute drawing commands in buffer
Move glLoadIdentity at the position of glPushMatrix. glPushMatrix can be removed since it probably does nothing, as well as glFlush. gluLookAt shoud be the first command after glLoadIdentity, since it is a complete view transformation. glTranslate can be incorporated into gluLookAt. Please read third chapter of some of the previous releases of OpenGL Programming Guide.