PDA

View Full Version : Correct rotating an object in glOrtho2d



lacasrac
02-01-2011, 03:22 AM
http://s2.postimage.org/m695jkqe0/rotate.png

I want to rotate my object on its own center in glOrtho2D, now my object rotate on its top-left point. It is not good for me.

In 2d, where is x,y, and z coords too, it works perfect, but not in glOrtho, why?

What is the solution?

Rickard
02-07-2011, 03:41 AM
The top left point for your object is the objects origo so to say.
If you want to rotate around its center you first have to translate(move) the object so its center is in its origo and then move it back

eg:
translate to point
rotate
translate back