code: def matrix_to_gl(matrix):
      
      matrix = np.asanyarray(matrix, dtype=np.float64)
      if matrix.shape != (4, 4):
          raise ValueError('matrix must be (4,4)!')
  
      # switch to column major and flatten to (16,)
      column = matrix.T.flatten()
      # convert to GLfloat
      glmatrix = (gl.GLfloat * 16)(*column)
  
      return glmatrix
docs: Convert a numpy row- major homogenous transformation matrix
      to a flat column- major GLfloat transformation.
  
      Parameters
      -------------
      matrix : (4,4) float
        Row- major homogenous transform
  
      Returns
      -------------
      glmatrix : (16,) gl.GLfloat
        Transform in pyglet format