PDA

View Full Version : rotate the texture



hwj_just
07-07-2005, 04:43 PM
hello i want to rotate the texture and my code is like this:
glMatrixMode[GL_PROJECTION];
glLoadIdentity[];
glOrtho[ m_dOrthoD, m_dOrthoD,
m_dOrthoD, m_dOrthoD,
-50, m_dOrthoD + m_dOrthoD ];
glTranslatef[0.0, 0.0, m_dOrthoD]];
glMatrixMode[GL_TEXTURE];
glPushMatrix[];
glLoadIdentity[];
glTranslatef[0.5,0.5,0.5];
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];
glTranslatef[-0.5,-0.5,-0.5];

then i could not rotate the texture .but if i put the
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
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!