rotate the texture

hello i want to rotate the texture and my code is like this:
glOrtho[ m_dOrthoD, m_dOrthoD,
m_dOrthoD, m_dOrthoD,
-50, m_dOrthoD + m_dOrthoD ];
glTranslatef[0.0, 0.0, m_dOrthoD]];
glRotatef[float[m_nAngleAroundY], 0.0, 1.0, 0.0];
glRotatef[float[-m_nAngleAroundX], 1.0, 0.0, 0.0];
glRotatef[float[m_nAngleAroundZ], 0.0, 0.0, 1.0];

then i could not rotate the texture .but if i put the
glOrtho( m_dOrthoD, m_dOrthoD,
m_dOrthoD, m_dOrthoD,
-50, m_dOrthoD + m_dOrthoD );
glTranslatef(0.0, 0.0, m_dOrthoD));
after glMatrixMode(GL_TEXTURE);i can get the right rotation.why is it like this? am i do it right?any one who could give me some suggestion?thank you very much!

Do the actual drawing code modify the current matrix? Hint: what matrix is current when leaving the posted code in the working vs. the non-working case?

i think that my actual drawing code doesnot modify the current matrix,just do the texture mapping from back to frount.i cannot understand your hint,could you please expatiate it ?thank you very much!

My idea was that perhaps some code, after what you displayed, modified the current matrix. Then your changes to the texture matrix would be changed/overwritten.

To verify if this is the problem or not, just make the projection matrix current again, after you set up the texture matrix, in the non-workin scenario.

I’m really not sure, but it might be because you’re under a projection matrix. Maybe gl is expecting a modelview matrix before. That sounds strange thought so forget me if I’m completly wrong.