When using Euler angles the axis change after each rotation:
Code: Select all
glRotatef(angleX, 1.0f, 0.0f, 0.0f);
glRotatef(angleY, 0.0f, 1.0f, 0.0f);
glRotatef(angleZ, 0.0f, 0.0f, 1.0f);
I have read that quaternions will solve this problem.
However, when trying to implement a quaternion library (http://www.sacredsoftware.net/tutorials ... ions.xhtml) the model was translated off-screen.
Code: Select all
Quaternion q;
int main(void) {
q = Quaternion_identity();
while(1) {
m4x4 m = Quaternion_toMatrix(q);
int i;
for(i = 0; i < 4 * 4; i++) {
printf("%d %d\n", i, m.m[i]);
}
glMultMatrix4x4(&m);
}
}
I experimented with the fixedToFloat and floatToFixed macros. For example I discovered that the following will give you a regular sine implementation:
Code: Select all
fixedToFloat(sinLerp(degreesToAngle(angle)), 12);
Has anyone been able to get quaternions working with VideoGL? Please help!