法二:获得ModelMatrix


Everything you do, matrix multiplication included, looks good, except this : glGetFloatv(GL_MODELVIEW_MATRIX, mvMatrix), which returns ViewMatrix * ModelMatrix. Sadly, this is old-school OpenGL, and there is no mean to only get the model matrix. 

Workaround : loadIdentity, translate, rotate, getfloat (now you have ModelMatrix), loadIdentity, gluLookAt, translate, rotate (now opengl is happy with its modelviewmatrix)

你可能感兴趣的:(法二:获得ModelMatrix)