I understand how glPushMatrix() and glPopMatrix() work but I am not sure when it is best to use them. I have read that you should use them when you have hierarchical translations. But at which point is it usually more efficient to use these functions instead of just translating back manually? For example could one say for sure which is more efficient? :
a)
glTranslatef(x, y, z);
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
render();
glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
glTranslatef(-x, -y, -z);
b)
glPushmatrix();
glTranslatef(x, y, z);
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
render();
glPopMatrix();