I am attempting to write a game which involves a ball which rolls around the playing area. To do this I set up a display list to store the ball, then in my drawing routine I call glCallList (ball); after some transformations to get the ball in the right place, I then reload the Identity matrix and get on with drawing the rest of the scene.
To start with I just had the ball moving (not actualy rolling) so all i needed was this:
glTranslatef (ballX, -0.5, ballZ); glCallList (ball);
I am now trying to make it rotate so the following code must be used:
glTranslatef (ballX, -0.5, ballZ); glRotatef (some rotation); glCallList (ball);
to find ‘some rotation’ I must somehow accumulate all of the previous rotations and then add the one for the current motion. How can I do this?