开发者

OpenGL and XNA Matrix differences

XNA has the following Matrix objects under BasicEffect

public Matrix World
public Matrix View
public Matrix Projection

OpenGL uses the following defines for glMatrixMode()

GL_MODELVIEW
GL_PROJECTION

I'm not really sure why one would have more than the other, to be honest. I'm porting a GL game over, and it would be nice if I could get an explanation of the similarities and differences.

Does World = GL_MODELVIEW, or 开发者_JAVA百科does View = GL_MODELVIEW?

What would I do to render the same scene, just load an Identity Matrix into the one I don't use?

Thanks alot!


The name of GL_MODELVIEW is a reflection of the fact that it represents both the view of a scene and the transformations applied on the world, since these transformations are opposites (translating the camera 5 units left equals translating the world 5 units right). I am not sure what XNA's matrices represent, but I think that XNA simply represents these transformations as two different matrices. For porting you game, then, you would have your camera apply its transformation to the View Matrix, and other things apply transformations to the Model matrix. (Please correct me if I am wrong.)

http://www.toymaker.info/Games/XNA/html/xna_matrix.html describes what the XNA matrices represent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜