Currently browsing tag

matrices

18. OpenGL Popping and Pushing Matrices

OpenGL Pop and Push Matrices Tutorial PreviewWhen drawing objects in OpenGL, it can be annoying that you do a translation, and then before drawing the next shape, you have to do a reverse translation to fix your positions. Well OpenGL being a state machine, has the ability to pop and push the current model view matrix, meaning you push on a duplicate of the current matrix before you do your translation, and then revert to the old matrix by pulling the new one off.