PDA

View Full Version : Accumulating rotations



Amit5
12-03-2009, 02:37 AM
Hello,

I'm trying to implement an arcball.
I'm using glRotate() and i would like to accumulate the rotation in order for the object to start rotating from the last position and not reset to it's origin position.

i've tried using glGet(MODELVIEW,matrix) after calling glRotate() and using multMatrix(matrix) before and it doesn't seems to work..

thanks in advance..

Dark Photon
12-03-2009, 06:31 AM
I'm trying to implement an arcball.
I'm using glRotate() and i would like to accumulate the rotation in order for the object to start rotating from the last position and not reset to it's origin position.

i've tried using glGet(MODELVIEW,matrix) after calling glRotate() and using multMatrix(matrix) before and it doesn't seems to work..
Let's see some code.

I understand what you're saying, but there's something missing here as that "just works".

scratt
12-03-2009, 07:54 AM
There's quite a nice little web page about this actually : http://www.rainwarrior.thenoos.net/dragon/arcball.html

I found it one day looking for something else.

One thing I would say is that for anything that free rotates then putting together a nice Matrix and Quaternion class I found makes things a lot smoother. There are plenty of nice examples out there you can Google for. Quaternions are not *required* to do this, but the way that you can rotate trivially without getting Gimbal lock when using Quaternions is very helpful.

And the best thing is you don't have to actually understand Quaternions if you don't wish to. :)

Brolingstanz
12-03-2009, 08:35 AM
*cough*

http://www.opengl.org/wiki/Math_and_algorithms