Viewing: Specify the location of the viewer or camera.
Modeling: Move objects around in a scene.
Viewing transformation is essentially nothing but a modeling transformation. They are used to made purely as a convenience to the programmer.
The term modelview indicats that viewing transformation and modeling transformation are combined in the transformation pipeline into a single matrix-modelview matrix.
Viewing transformation全局的移動所有的物體.
Modeling transformation一般是局部的移動物體, 當然也可以全局的移動.
glTranslatef();
glRotatef();
注意, 變換可以看成是對坐標系進行變換, 也可以看成是對物體的坐標進行變換, 而坐標系不受影響.
1. 對物體坐標進行變換: 因為矩陣的管理使用的是棧的形式, 所以實際上是glRotatef()先執行, 然后glTranslatef()后執行, 即先旋轉, 后移動, 與代碼的順序正好相反. 實際內部是這樣進行的, 但是這樣一來, 矩陣的變換語句就得逆著來. 這也是為什么頂點坐標向量在OpenGL中要放在右邊, 而變換矩陣要放在左邊進行相乘.
2. 對坐標系進行變換: 這樣就好理解一些, 因為變換結果與變換語句的順序是一致的.