opengl model transformations
I am attempting to move all my game objects independantly but it isn't working.
Code:
void moveAstroids(void)
{
for_each(astroids.begin(),astroids.end(),mem_fun(&Astroid::translate));
glutPostRedisplay();
}
Code:
void Astroid::translate(){
glPushMatrix();
glTranslatef(velocity,velocity,0);
Astroid::draw();
glPopMatrix();
}
when I comment out the Push and Pop statements all the game objects move in tandem according to one translation. I am trying to get each object to move independantly. I tried using glLoadIdentity(); but this had the same effect.