View Full Version : Rotation

03-23-2000, 05:50 AM

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


03-23-2000, 06:19 AM
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...

03-23-2000, 06:21 AM
OOPS,looks like my picture has crashed...

03-23-2000, 09:02 PM
Originally posted by holy_moly:
OOPS,looks like my picture has crashed...

Use UBB code... CODE tag will do fine...