11-13-2001, 03:35 PM

Hi.

I am coding a billiard game as an school project. I need some help with the rolling of the ball. I have the rolling angles around x- and z-axes, but I don't know how to combine them to form the final rotation. Using glRotate*() twice in a row is not good (I have heard terms gimble lock and quaternion defining my problem.) How is this problem handled correctly?

This is what I tried, but didn't work: glTranslatef(balls[i]->pos[0],balls[i]->pos[1],balls[i]->pos[2]);

glRotatef(rotx, 1.0, 0.0, 0.0);

glRotatef(rotz, 0.0, 0.0, 1.0);

glutWireSphere(0.2,15,12);

I am coding a billiard game as an school project. I need some help with the rolling of the ball. I have the rolling angles around x- and z-axes, but I don't know how to combine them to form the final rotation. Using glRotate*() twice in a row is not good (I have heard terms gimble lock and quaternion defining my problem.) How is this problem handled correctly?

This is what I tried, but didn't work: glTranslatef(balls[i]->pos[0],balls[i]->pos[1],balls[i]->pos[2]);

glRotatef(rotx, 1.0, 0.0, 0.0);

glRotatef(rotz, 0.0, 0.0, 1.0);

glutWireSphere(0.2,15,12);