Transformations Fun with the Model View Matrix

All we have done so far is define static geometries in the form of triangle lists. There was nothing moving, rotating, or scaling. Also, even when the vertex data itself stayed the same (e.g., the width and height of a rectangle composed of two triangles along with texture coordinates and color), we still had to duplicate the vertices if we wanted to draw the same rectangle at different places. Look back at Listing 7-11 and ignore the color attributes of the vertices for now. The two rectangles only differ in their y-coordinates by 200 units. If we had a way to move those vertices without actually changing their values we could get away with defining the rectangle of Bob only once, and simply drawing him at different locations. And that's exactly what we can use the model-view matrix for.

0 0

Post a comment