I want to place 4 rotating cubes ( rotation over themself )
they are placed at
10, 0, 0
-10, 0, 0
0, 0, 10
and
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;
glPushMatrix();
glLoadIdentity();
glTranslatef(GetPos().x, GetPos().y, GetPos().z);
glRotatef( fRotation, 0.0f, 1.0f, 0.0f);
glBegin(GL_QUADS);
//Well I draw the cube here...
glEnd();
glPopMatrix();
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 ?
PLEASE HELP !!!
Evil-Dog
Sleep is a waste of time