WEEK06
Topic:
- 複習上週主題
- 編譯上週Transformation程式
- 打光Lighting
- 作業:利用mouse / keyboard實作
A. 複習上週主題 & 編譯上週Transformation程式
STEP 1: 開啟範例模型執行檔(Transformation)
STEP 2: 開啟 & 編譯範例程式碼(Transformation)
去除顏色與打光
B. 開啟Lighting(打光)
STEP 1: 開啟範例程式碼
STEP 2: 加入打光功能
STEP 3: Result
C. 加入keyboard、mouse函式
STEP 1: keyboard()
void keyboard(unsigned char key, int x, int y)
{
printf("now: %c (%d, %d)\n", key, x, y);//列印出鍵盤輸入key,與游標位置(x, y)
}
STEP 2: mouse()
void mouse(int button, int state, int x, int y)
{
printf("button:%d state:%d (%d, %d)\n", button, state, x, y);
//button:滑鼠左(0)、中(1)、右鍵(2)
//state:按下GLUT_DOWN(0)、放開GLUT_UP(1)
//游標位置(x, y)
}







沒有留言:
張貼留言