dongzi0850
dongzi0850
2011-01-18 23:39

GO-OpenGL LoadMatrixd和GetDoublev问题

  • opengl
已采纳
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();
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • doujianmin6527 doujianmin6527 10年前

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

    点赞 评论 复制链接分享

为你推荐