🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

About Projection Maxtrix

Started by
1 comment, last by pumpkinwolf 15 years, 8 months ago
I just get a piece of code, which do some work of Projection in 3D engine code just like: real div_v = 1.0f / 4.33f; real vph = (real)m_h; real ax = (real)m_h / (real)m_w; real ay = ax / 2.0f; m_scr_z = (m_w / 2.0f) / tanf(m_fov / 2.0f); Matrix mt; // | scrz 0 0 0 | // m = | 0 scrz 0 0 | // | 0 0 0 1 | // | 0 0 1 0 | mt.row0.x = -scrz; mt.row1.y = -scrz; mt.row2.z = 0.0f; mt.row3.w = 0.0f; mt.row3.z = 1.0f; mt.row2.w = 1.0f; // | ax 0 0 cx | // m = | 0 ay 0 cy | // | 0 0 az cz | // | 0 0 0 1 | m_view_screen = Matrix::StaticIdentity();//.Identity(); m_view_screen.row0.x = ax; m_view_screen.row1.y = ay; m_view_screen.row2.z = az; m_view_screen.row0.w = cx; m_view_screen.row1.w = cy; m_view_screen.row2.w = cz; m_view_screen = m_view_screen * mt; Who can explain this code?I think the mt is projection matrix, at begining the m_view_screen is a matrix for rotation and translation, but what I confuse is the method of calculate ax, ay, az and cz. I think ax should be a aspect, but it be h/w, so i can't understander, who understand the algorithm of this matrix? pls help me ,and thanks.
Advertisement
Perhaps those 2 do help:
http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/perspective.html
yep, thx, that's just i want!

This topic is closed to new replies.

Advertisement