Adding Rotation

Now that we have a projection matrix configured and a model matrix in place to move our table around, all we need to do is rotate the table so that we’re looking at it from across an angle. We’ll be able to do this with one line of code using a rotation matrix. We haven’t worked with rotations yet, so let’s spend some time to learn more about how these rotations work.

The Direction of Rotation

The first thing we need to figure out is around which axis we need to rotate and by how much. Let’s take another look at Figure 25, Right-handed coordinate system. To figure out how an object would rotate around a given axis, we’ll use the right-hand rule: take your right hand, make a fist, and point your thumb in the direction of the ...

Get OpenGL ES 2 for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.