Understanding glLookAt

Hi there, I know that this question may be answered somewhere else, but I can’t find or understand it.
I’m drawing axes at origin and keeping them fixed in position, I’m trying to rotate my camera with glLookAt:

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
DrawAxes();     // Draws X-axis in red, Y in green, Z in blue
glRotated( m_dRotX, 1.0, 0.0, 0.0 );
glRotated( m_dRotY, 0.0, 1.0, 0.0 );
glRotated( m_dRotZ, 0.0, 0.0, 1.0 );
gluLookAt( m_dCameraPos_X, m_dCameraPos_Y, m_dCameraPos_Z, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 );
SwapBuffers( m_pDC->m_hDC );

Starting from a position ( 0, 0, 100 ), I’m rotating around Y-Axis and I expect to see the red bar (X-axis) become short and blue bar (Z-axis) become longer, but nothing is moving.
What am I missing?

Thanks in advance.

You’re drawing the axes first, when the model-view matrix is the identity matrix, then changing the matrices afterwards (and not drawing anything with the changed matrices).

Well, if I want to keep the axes fixed in their positions, how should I rotate my camera?

Before going any further read this.

Reverse order of operations. Transformations cannot affect drawing if they are set after it.
So, try something like this:


Clear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();

gluLookAt( m_dCameraPos_X, m_dCameraPos_Y, m_dCameraPos_Z, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ); 
glRotated( m_dRotX, 1.0, 0.0, 0.0 );
glRotated( m_dRotY, 0.0, 1.0, 0.0 );
glRotated( m_dRotZ, 0.0, 0.0, 1.0 );DrawAxes();     // Draws X-axis in red, Y in green, Z in blue

SwapBuffers( m_pDC->m_hDC );

In any case, read Viewing in 3D from the OpenGL Programming Guide.