OpenTK matrix transformations

只谈情不闲聊 提交于 2019-12-01 09:47:25

Edit (Adding real answer from comment)

Your OpenTK matrices are transposed by default. It looks to use row vectors instead of column vectors. Therefore you need to do the multiplication as (model * view * proj), not (proj * view * model). Either that or transpose all the matrices before uploading them.


Actually clip space is not from -1 to 1, but rather from -W to W, where W is the fourth component of the clip space vector.

What you're probably thinking of is called normalized device coodinates, which ranges from -1 to 1 on each axis. You get this value by dividing the X,Y, and Z coordinates of the clip space vector by the clip space W component. This division is called perspective division.

This is done behind the scenes after you pass the clip space coordinate to gl_Position.

Your clip space coordinate is 0 though, which doesn't seem to be correct to me.

There's some more detail here: OpenGL FAQ : Transformations.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!