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全局的移動(dòng)所有的物體.
Modeling transformation一般是局部的移動(dòng)物體, 當(dāng)然也可以全局的移動(dòng).
glTranslatef();
glRotatef();
注意, 變換可以看成是對(duì)坐標(biāo)系進(jìn)行變換, 也可以看成是對(duì)物體的坐標(biāo)進(jìn)行變換, 而坐標(biāo)系不受影響.
1. 對(duì)物體坐標(biāo)進(jìn)行變換: 因?yàn)榫仃嚨墓芾硎褂玫氖菞5男问? 所以實(shí)際上是glRotatef()先執(zhí)行, 然后glTranslatef()后執(zhí)行, 即先旋轉(zhuǎn), 后移動(dòng), 與代碼的順序正好相反. 實(shí)際內(nèi)部是這樣進(jìn)行的, 但是這樣一來, 矩陣的變換語句就得逆著來. 這也是為什么頂點(diǎn)坐標(biāo)向量在OpenGL中要放在右邊, 而變換矩陣要放在左邊進(jìn)行相乘.
2. 對(duì)坐標(biāo)系進(jìn)行變換: 這樣就好理解一些, 因?yàn)樽儞Q結(jié)果與變換語句的順序是一致的.