OK,

I’m going to try and explain this better this time. In OpenGL, the glTransform and glRotate are cumulative (presumably because they operate on a homogeneous matrix) in that if you rotate and then transform your axis for the transformation will have been rotated as well:

glLoadIdentity();

glTranslatef(v1.x, v1.y, v1.z);

glRotatef(angle, 0.0f, 0.0f, 1.0f);

glBegin();

// Textured quad drawn here

glEnd();

glFlush();

Vector v1 stores the current location of an object. The Problem:

Every time you want to move an object that has velocity, you base your next position on the screen off of:

x += velocity * cos(angle * (PI/180));

y += velocity * sin(angle * (PI/180));

Well, what if you want to rotate your object and keep the velocity going the same direction? The way I have it now, if you rotate the object, it will rotate the modelview coordinate system, which in turn applies the velocity to the new angle the next time around in the game loop. I don’t want this behavior. I want the velocity to be constant in one direction, until you specifically put on thrusters in a different direction. In other words, you could rotate all you want, but you’d still be going the same direction until you hit the thrusters, just like the game Asteroids.

What do I do to eliminate this undesired effect? I’m storing variables X, Y, Z, velocity, deltaVelocity, angle (in degrees) and deltaAngle.

If I were to describe this effect visually, imagine in the real Asteroids applying the thrusters once, then letting go and rotating. In the real game the ship will rotate in place, and move in a constant direction until you thrust somewhere else.

However, in mine if you hold down left or right while moving (but not thrusting) the ship will move in a circle with a diameter directly proportional to the amount of velocity you have. Nice for drawing circles - terrible for cloning Asteroids. How do I keep the velocity from being rotated to another direction unless I specifically apply thrusters?

I hope everyone can understand what I’m saying this time and I appreciate the patience of people who have read my other post and maybe DID understand it. I have tried the one solution suggested so far and while it did make my code more complete, the problem still exists - unless I was simply mistaken in how I implemented it. I’m aware of the fact that the problem is my lack of knowledge, but no book I’ve read discusses this.

I’m looking forward to any help anyone can provide. This is my first project with OpenGL and I’ve already learned a lot. Thanks!