<<< glm::value_ptr example | Index | Scaling matrix example >>> |
Each row and column in glm::mat4 is zero-based:
glm::mat4 m4( 1.0f ); // construct identity matrix m4[ 0 ] // column zero m4[ 0 ].x // same as m4[ 0 ][ 0 ] m4[ 0 ].y // same as m4[ 0 ][ 1 ] m4[ 0 ].z // same as m4[ 0 ][ 2 ] m4[ 0 ].w // same as m4[ 0 ][ 3 ]
Each column of matrix glm::mat4 is a vec4.
To set the entire column, e.g. for translation,
glm::mat4 m4( 1.0f ); // construct identity matrix m4[ 3 ] = glm::vec4( vec3( x, y, z ), 1.0f );
Related: see Chapter 6. Objects in Motion, Translation article from Learning Modern 3D Graphics Programming tutorial
<<< glm::value_ptr example | Index | Scaling matrix example >>> |