# Quick question: 2D Ortho rotation

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

## 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 on other sites
use
glRotatef(180,0,0,1);
bye

##### Share on other sites
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 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 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 on other sites
Quote:
 Original post by AzCoderTo 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 :)

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 14
• 14
• 45
• 22
• 27
• ### Forum Statistics

• Total Topics
634044
• Total Posts
3015210
×