2.
3.
static void resize(int width, int height)
{
const float ar = (float) width / (float) height; /// aspect ratio 長寬比
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 2.0, 100.0);
///因為這個透視投影很奇怪, camera 投影中心,在0,0,0
///但茶壺也在0,0,0, 茶壺裡面中心點,看不到茶壺
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,2, 0,0,0, 0,1,0);/// 新加程式
}




沒有留言:
張貼留言