Jump to content
  • Advertisement
Sign in to follow this  
tomsh

rotate opengl

This topic is 2555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!