   gluLookAt not working
  In this test program I am trying to have some autonomous camera controls.  Right now I am attempting to just set the camera to a certain position every 100 msec.  I'm just setting to the same position every time so nothing should change.  It's not working, it sets the camera to some weird angle...what am I doing wrong?#include "glut.h"void drawGrid(float dim, int div, float bright);void glut_display(){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);drawGrid(100,100,.5);glutSwapBuffers();}void glut_reshape(int new_width, int new_height){glViewport(0, 0, (GLsizei) new_width, (GLsizei) new_height);glMatrixMode(GL_PROJECTION);glLoadIdentity();gluPerspective( 40,/* view angle */new_width/(float)new_height,/* aspect ratio */0.1, 100 );/* near and far clip planes */gluLookAt(0, 0, 5,0, 10, 0,0, 1, 0 );glMatrixMode(GL_MODELVIEW);}void glut_timer(int val){glMatrixMode(GL_MODELVIEW);glLoadIdentity();gluLookAt(0, 0, 5,0, 10, 0,0, 1, 0 );glutPostRedisplay();glutTimerFunc(100, glut_timer, 1);}int main(int argc, char *argv[]){glutInit(&argc, argv);glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );glutInitWindowSize(640, 480);glutInitWindowPosition(100, 100);glutCreateWindow("a window");glutDisplayFunc(glut_display);glutReshapeFunc(glut_reshape);glMatrixMode( GL_PROJECTION );glLoadIdentity();glMatrixMode( GL_MODELVIEW);glLoadIdentity();glutTimerFunc(100, glut_timer, 1);glutMainLoop();return 0;}void drawGrid(float dim, int div, float bright){float step = dim/div, half = dim/2;int hdiv = div>>1;float midcolor = bright*1.5;glBegin(GL_LINES);glColor3f(bright, bright, bright);//draw left halffor(int i=0; i<hdiv; ++i){//vertical linesglVertex3f((i-hdiv)*step, -half, 0);glVertex3f((i-hdiv)*step, half, 0);//horiz linesglVertex3f(-half, (i-hdiv)*step, 0);glVertex3f(half, (i-hdiv)*step, 0);}//draw rightfor(int i=hdiv+1; i<=div; ++i){//vertical linesglVertex3f((i-hdiv)*step, -half, 0);glVertex3f((i-hdiv)*step, half, 0);//horiz linesglVertex3f(-half, (i-hdiv)*step, 0);glVertex3f(half, (i-hdiv)*step, 0);}glEnd();//draw middleglEnable(GL_LINE_SMOOTH);glLineWidth(1.5);glBegin(GL_LINES);//vertical linesglVertex3f(0, -half, 0);glVertex3f(0, half, 0);//horiz linesglVertex3f(-half, 0, 0);glVertex3f(half, 0, 0);glEnd();glLineWidth(1);glDisable(GL_LINE_SMOOTH);}
  no idea what u want, try the following,also i dont know if glut timers are the best way, i believe its best to call the display func ion the idle callbackvoid glut_timer(int val){static float A=0.0;A += 0.1;glMatrixMode(GL_MODELVIEW);glLoadIdentity();gluLookAt(sin(A)*5, 1, cos(A)*5,0, 10, 0,0, 1, 0 );glutPostRedisplay();glutTimerFunc(100, glut_timer, 1);}