Rotation

HI

As good as I know glRotate rotates an object about the origin, so do somebody know how to rotate an object about one of its point(not the origin).

I know one solution:
I move the object so that this point gets to the origin. Then I rotate the object then put it back to its real place.

I don’t want to write my own rotate function, so is there a way to do this with OpenGl functions?

Thanks in advance

       NeckCracker

hi there,
imagine a cube…
the very middle point of the cube is 0,0,0.
(so the vertices could be from -0.5 to 0.5 for example)

-0.5y ------------ 0.5y
| |
| 0.0 |
| ° |
| |
------------
-0.5x 0.0x 0.5x

So if you rotate now,the cube will rotate around its own axis…

Now,if you dont want to rotate this way,
just build the cube starting at -0.5 for exampleas the middle point (or take 0,0,0 as any edge point) and it will rotate around this point…
sorry for the bad drawing,i hope i said everything right…

OOPS,looks like my picture has crashed…

Originally posted by holy_moly:
OOPS,looks like my picture has crashed…

Use UBB code… CODE tag will do fine…