Inside each of your my_gl implementations end it with glLoadMatrix(top())

OpenGl doesn't know or care about how you arrived at matrix M. Whatever
the matrix is, that will be multiplied with the vertex to transform the
object and finally render it.