Understanding OpenGL’s Matrix Stack
In graphics, the current transformation applied to a point or object is determined by the current model-view-projection (MVP) matrix. This is a culmination of the model matrix, the view matrix, and the projection matrix. We first discussed these matrices as coordinate spaces in Chapter 4, Graphics and Game Engine Components. Each one has a specific use in the graphics pipeline, as is shown in Figure 14.1 (this diagram has been reinserted here from Chapter 4, Graphics and Game Engine Components, for your convenience):
Figure 14.1: The graphics pipeline
The coordinates or points that define a graphics object are stored in a model’s local coordinate system. They define the geometry of the object independently of where it is situated in world space. As we saw in Chapter 4, Graphics and Game Engine Components, a cube can be defined by six points, one for each of the vertices, thus:
cube.vertices = [(0.5, -0.5...