What's wrong please ?

I want to place 4 rotating cubes ( rotation over themself )
they are placed at
10, 0, 0
-10, 0, 0
0, 0, 10
0, 0, -10
so there’s one in each direction
but I can’t get this to work when I want to have a camera using gluLookAt
I don’t know what’s wrong

I call a DrawScene function and then Camera.SetCamera() which is my own function that calculates the direction and position of the camera and call gluLookAt(…)
In my DrawScene I call the rendering function of the four cubes

static float fRotation = 0.0f;
glTranslatef(GetPos().x, GetPos().y, GetPos().z);
glRotatef( fRotation, 0.0f, 1.0f, 0.0f);


	//Well I draw the cube here...

fRotation += 18.0f;

and I guess this works
and my camera call is this

gluLookAt( m_vPosition.x, m_vPosition.y, m_vPosition.z, //Position vector
m_vPosition.x + cosf(GetRadian(m_vAngle.y + 90)), m_vPosition.y + cosf(GetRadian(m_vAngle.x + 90)), m_vPosition.z + sinf(GetRadian(m_vAngle.y + 90)), //Point At Vector
0.0f, 1.0f, 0.0f ); //Up vector

Do you see what’s wrong ?
Am I using the glPushMatrix() or glLoadIdentity() in a wrong way ?
Should I set the camera before drawing the geometries ? call glLoadIdentity before the gluLookAt ?

Sleep is a waste of time

Try it the other way round. First set your camera then do all object transformations. (But please don’t forget to remove the glLoadIdentity() in your object transformation).
Long explantion:
You have to read all transformations backwards. If your current modelview matrix is M and you insert a new matrix N (via translate, rotate or multiply) you’ll get MN. Your vertices will be multiplied from the right side yielding MN*v where v is the vertex position.

Thanks alot stefan it works perfectly
But I totally DON’T get it…
I tought I understand how openGL works it seems I don’t…
How come I don’t need to set the modelview to identity for each cube
doesn’t the transformation for the second cube affect the first one ?
Or the transformation only affect the next glBegin/End ???
is it because of my glPushMatrix and glPopMatrix ? which I’m not sure what they do and why I should use them ?
Please enlighten me i’m confused hehehe

Sleep is a waste of time

Take a look in the “redbook”. The first release of this book is available online (e.g. http://fly.cc.fer.hr/~unreal/theredbook/))
In chapter 3 you’ll find good explanations of how opengl does its transformations.