I am learning OpenGl for Android. The tutorial on this site: http://www.learnopengles.com/android-lesson-one-getting-started/#comment-1959, it take model matrix times view matrix and times projection matrix in order to display it on the normalized device coordinate. However, in the book "OpenGL ES2 for Android", chapter 3, it only take mode matrix * projection matrix. So my question is: is it neccessary to need 3 matrices, if not, in which case do i use model and projection, which case do i use model view projection?
0
votes
2 Answers
1
votes
In general you use a view matrix when you want to include a camera into your scene that can move and look around.
Therefore the view matrix is used to represent the location and orientation of a camera in your 3d world. It is used to transform objects in your 3d world from "world space" (the exact location and rotation of objects) into "camera space" (the location and rotation of objects as they appear to the camera).
Model * View * Projection
is actually completely wrong for OpenGL. OpenGL uses column-major matrices, which means the canonical (formal math notation) is actuallyProjection * View * Model
. Direct3D uses row-major, which is whereModel * View * Projection
would actually be correct. That said, if you transpose the result you can do either order but it is generally understood that you use the column-major canonical form and avoid transposition whenever possible in GLSL. – Andon M. Coleman