
打開檔案 更改eye 視野角度
center 以中心點角度
up 讓機器人旋轉

更改 fovy 攝影機的視角遠近
更改 aspect 攝影機的視角寬度
更改 zNear 攝影機投影的大小
更改 zFar 攝影機背景屏幕的遠近 可將機器人隱藏至幕後

加入gluLookAt(0.3,10,0.3, 0,0,-6, 0,1,0);
類似新增攝影機角度

#include<math.h>
void motion(int x,int y)
{
float angle=x*3.1415926/180.0;
float cameraY=(y-300)/100.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(5*cos(angle),cameraY, 5*sin(angle)-6, 0,0,-6, 0,1,0);
glutPostRedisplay();
}
寫入motion函示 加入圓周率之後可以旋轉
呼叫 glutMotionFunc(motion); 執行之後就可以轉動

沒有留言:
張貼留言