glLoadMatrixf glPopMatrix glMultMatrixf

glLoadMatrixf glPopMatrix glMultMatrixf

glPushMatrix didn't fail to push onto the stack; it's job is to push a copy of the current matrix onto a stack of matrices. Those matrices on the stack don't interact at all. You only manipulate the current, top-most, matrix at any given time.

Example 1:
   command                 result
glLoadMatrixf(A)       stack = [A]
glPushMatrix()         stack = [A, A]
glLoadMatrixf(B)       stack = [B, A]
glPopMatrix()          stack = [A]

Example 2:
   command                 result
glLoadMatrixf(A)       stack = [A]
glPushMatrix()         stack = [A, A]
glMultMatrixf(B)       stack = [AB, A]
glPopMatrix()          stack = [A]


Notice that glLoadMatrixf replaced the top-most matrix, whilst glMultMatrixf just manipulated it.
Likewise, functions such as glTranslate* and glRotate* just manipulate (by multiplication) the top-most matrix.

你可能感兴趣的:(glLoadMatrixf glPopMatrix glMultMatrixf)