GO-OpenGL LoadMatrixd和GetDoublev问题

GO-OpenGL LoadMatrixd和GetDoublev问题

问题描述:

gl.MatrixMode(gl.MODELVIEW)
gl.PushMatrix()

m := new([16]float64)
setIdentity(m)

gl.LoadMatrixd((*gl.GLdouble)(&m[0]))
gl.Rotated(90, 0, 1, 0)
gl.GetDoublev(gl.MODELVIEW_MATRIX, (*gl.GLdouble)(&m[0]))
gl.PopMatrix()

fmt.Printf("%f", m[0])
// m[0] == forward.x

The contents of m doesn't not change after the GetDoublev. I am trying to port some C code (which works and it basically this). What am I doing wrong?

The C code as requested:

//m is float[16] set to identity
glMatrixMode(GL_MODELVIEW);
glPushMatrix();

glLoadMatrixf(m);
glRotatef(90, 0,1,0);
glGetFloatv(GL_MODELVIEW_MATRIX, m);
glPopMatrix();

You must call sdl.SetVideoMode() before you can use Matrix functions.