Moving the GLUT Teapot Model Using a Transformation Matrix

I’m new to OpenGL, and so far I have a program that renders the teapot model that’s built into GLUT on the screen. However, I want to also have the teapot move. Right now I have a function that generates a 4x4 transformation matrix and another one that generates a 3x3 one, both using a few input values. I’ve printed out the contents of the matrixes and the numbers are correct. I just don’t know how to apply them to the existing teapot model, glutSolidTeapot(1.0);

The matrixes are generated using the Eigen library, but I’m mostly using it for the matrix multiplication. Eigen makes it very easy to access the individual values of the matrix, so if that format is going to cause problems. Is there any way I can extract the teapot’s matrix and replace its values with the ones in my matrix? Will I have to do so for every vertex in the teapot? If so, how?

If you have a 4x4 matrix, you can make it the current transformation matrix using glLoadMatrix, or you can post-multiply it to the current transformation matrix with glMultMatrix.

The argument should be 16 contiguous float or double values in column-major order.

OpenGL convention is that transformations have the matrix on the left and a column vector on the right, so the translation component is the right-hand column of the matrix (elements 12, 13 and 14 for column-major order).

Note that all of the OpenGL matrix functions are deprecated in modern OpenGL. But then so are many of the functions used by the rendering functions in GLU and GLUT (including glutSolidTeapot, which itself uses the OpenGL matrix functions).