# OpenGL Rotation

Printable View

• 05-21-2008
satish.annauniv
OpenGL Rotation
hi alll!!
I need to rotate a 3D object about its origin..This topic was already discussed earlier.. Anyways Its just the continuation of this thread..
http://cboard.cprogramming.com/archi...p/t-61196.html

Can the same person(Darkness) elaborate on this..
• 05-21-2008
satish.annauniv
My problem statement: I am displaying a .wrl file successfully. Now i need to rotate on the screen based on mouse interaction. Now I am able to rotate that object with respect to screen's origin, i want the object to rotate with respect to its center point..
• 05-21-2008
h3ro
When you use matrices to rotate something, it is only possible to rotate about the origin. To rotate around the center, you need to move you mesh to the origin, then rotate it, and then move it back
• 05-21-2008
DavidP
I echo what h3ro said.

To really understand why it is this way, you need to take to learn linear algebra and then study matrix transformations in computer graphics. But the jist of it is: translate the object to the origin, rotate it, translate it back to its original position.
• 05-21-2008
satish.annauniv
I know that actually.. The problem is i don't know how to move to origin for that object being displayed.. ??
• 05-21-2008
satish.annauniv
i hav provided options such as zoom in and zoom out. When i zoom out and rotate, rotation takes place but does not rotate within that object's center. It rotates with respect t sceen's center point so it takes a huge diameter...
• 05-21-2008
h3ro
is the object is at 10,10,10 then just move it -10,-10,-10, then rotate
• 05-21-2008
satish.annauniv
ok i wil try n let u know sooon..
• 05-22-2008
satish.annauniv
thanks guys.. It worked successfully..