rotate opengl

Started by
2 comments, last by tomsh 12 years, 3 months ago
Hello, I tried to rotate my player.like that

glTranslatef(-cem.x, -cem.y, -13.f);

glPushMatrix();
glRotatef(45.f, 0.f, 0.f, 1.f);
rect->Draw();
glPopMatrix();


gameyh.pngNow to the problem...As you can see in the picture, I rotated the green player, and the blue and the red I didn't rotate.So, the green player is moving like in the green arrow, but I want he will move like in the red arrow(vertical)...What I mean it convinced the place rotate, I want only the image...Do you know what should I do?Thanks!
Advertisement
Use [font=CourierNew, monospace][size=2]glRotatef() before[/font][font=CourierNew, monospace] [/font][font=CourierNew, monospace][size=2]glTranslatef(). Matrix order determines what happens (A * B != B * A with matrices).[/font]
I already tried that, but it still weird.
I fixed it like that:



glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glPushMatrix();
glTranslatef(0.5f, 0.5f, 0.f);
glRotatef(deg, 0.f, 0.f, 1.f);
glTranslatef(-0.5f,-0.5f, 0.f);
glMatrixMode(GL_MODELVIEW);


It rotate only the texture, and not all..

This topic is closed to new replies.

Advertisement