Problem with gluLookAt

Hello.
I’m experiencing a weid problem , which I suppose comes from using the gluLookAt function.
I’m rotating an object with a mouse:

 
void drawingCallBack()
{
  glMatrixMode(GL_MODELVIEW); 
  glLoadIdentity();

  gluLookAt(0.0,0.0, zed, 0.0, 0.0, 0.0,0.0,1.0,0.0 ); 
  glClearColor(0.0, 0.0, 0.0, 1.0);   
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
  glClearDepth(1); 
  glDepthFunc( GL_LESS ); 
  transform(keyvalue, or mouse x,y delta);
  glEnable( GL_DEPTH_TEST )
..
draw_body();
..
GlFlush();
} 

When I rotate - the body “runs away” in z direction with each transformation.

I’m told to use the gluLookAt only in the drawing callback after the MODELVIEW matrix is loaded.

My question basicaly is - what’s the effect of multiple gluLookAt functions:

gluLookAt(…,zed,…);
gluLookAt(…,zed,…);

does it result in equivalent:
gluLookAt(…, n*zed, …) ?

after all it’s just a set of repeated transformations.

Thanks .

multiple gluLookat transformations would be cumulative but exactly how is a more complex issue, basically n*zed for a simple translate, but since you call glLoadIdentity then call gluLookAt there is no cumulative effect.

It’s not clear what is happening in your transform() function, perhaps some shenanigans…

You say you rotate using the mouse but it appears that the only variable there is ‘zed’ which implies you are translating.

Of course not knowing what’s happening in transform() it’s difficult to be sure but you may be lying about that glLoadIdentity() call. If you’re not calling glLoadIdentity and have been told to then you’re wasting our time with a foolishly misleading question :frowning:

Well…
I’m not “lying” about anything and have no intent to “waste our time with foolishly misleading questions”.
Let’s just end this discussion here.
Thank you.