Jump to content
  • Advertisement
Sign in to follow this  
storage

Quick question: 2D Ortho rotation

This topic is 4901 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

Just a quick question, how do I rotate a single texture around it's own center point in orthogonal mode? Thanks in advance! I'll remove this post when I get an answer, if I'm able to.

Share this post


Link to post
Share on other sites
Advertisement
If I use that code, it'll rotate in some other weird way, but not around it's own center.

Anyone else?

Thanks though :).

Share this post


Link to post
Share on other sites
First of all you have to consider how you render your quad. If you use a glTranslatef call before rendering, you just have to add a glRotatef(angle, 0, 0, 1) call before the translation. If you have your quad at some coordinates and you know the center you'll have to translate to "-center.x, -center.y, -center.z" first to put your quad in the origin. Then rotate, then translate back to "center".

A glRotatef will always translate through the origin so you need your quad to have its center in the origin to rotate it around its center.

If you don't want to do that, you're more than welcome to create your own line-rotation matrix where you can specify a point and a direction for the rotation axis.

Share this post


Link to post
Share on other sites
To rotate the quad that the texture is mappped to, switch to glMatrixMode(GL_MODELVIEW), and glRotate is the ticket.


To rotate the texcoords that are used by each vertex of the quad, switch to glMatrixMode(GL_TEXTURE), and glRotate is the ticket.

If you need something different.....clarify your request.

Share this post


Link to post
Share on other sites
Quote:
Original post by AzCoder
To rotate the quad that the texture is mappped to, switch to glMatrixMode(GL_MODELVIEW), and glRotate is the ticket.


To rotate the texcoords that are used by each vertex of the quad, switch to glMatrixMode(GL_TEXTURE), and glRotate is the ticket.

If you need something different.....clarify your request.


Switching to glMatrixMode(GL_TEXTURE) before rotating fixed it, thank you very much :)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!