glulookat not working :-(

Could someone please please please tell me what in the world is wrong with this???
Thanks,
Jesse www.laeuchli.com/jesse/

void GLEngine::turn(float x)
{
float tempx=lookDir.x-eye.x;
float tempz=lookDir.z-eye.z;
float rad=x0.01745f;
float newx=tempx
cos(rad) - tempzsin(rad);
float newz=tempz
cos(rad) + tempx*sin(rad);
lookDir.x=newx+eye.x;
lookDir.z=newz+eye.z;
gluLookAt(lookDir.x, lookDir.y, lookDir.z,
eye.x, eye.y, eye.z,
0.0, 1.0, 0.0);
}
void GLEngine::move(float x)
{
lookDir.z+=x;
gluLookAt(lookDir.x, lookDir.y, lookDir.z,
eye.x, eye.y, eye.z,
0.0, 1.0, 0.0);
}

I think the first 3 parameters are the coords of the eye, the next 3 ones the reference point and than there comes the up vector…

You don’t load the identity matrix before each call to gluLookAt. gluLookAt doesn’t load the matrix stack with the generated matrix, it multiplies it, and therefore you need to reset the matrix each time you generate a new look-at matrix.

gluLookAt( eye.x, eye.y,eye.z, target.x,target.y,target.z, vect.x,vect.y,vect.z);

that’s the way lookat works…

C U

rIO

so my code should look like this?
void GLEngine::turn(float x)
{
float tempx=lookDir.x-eye.x;
float tempz=lookDir.z-eye.z;
float rad=x0.01745f;
float newx=tempx
cos(rad) - tempzsin(rad);
float newz=tempz
cos(rad) + tempx*sin(rad);
lookDir.x=newx+eye.x;
lookDir.z=newz+eye.z;
gluLookAt(eye.x, eye.y, eye.z,
lookDir.x, lookDir.y, lookDir.z,
0.0, 1.0, 0.0);
}
void GLEngine::move(float x)
{
lookDir.z+=x;
gluLookAt(eye.x, eye.y, eye.z,
lookDir.x, lookDir.y, lookDir.z,
0.0, 1.0, 0.0);
}
I tried that, but it still didn’t work right…

Still can’t see any glLoadIdentity() before gluLookAt().

sorry, I forgot to post them. I did put them in.