2017年10月19日 星期四

Claire's Note #6

WEEK06

Topic:

  1. 複習上週主題
  2. 編譯上週Transformation程式
  3. 打光Lighting
  4. 作業:利用mouse / keyboard實作

A. 複習上週主題 & 編譯上週Transformation程式

STEP 1: 開啟範例模型執行檔(Transformation)



STEP 2: 開啟 & 編譯範例程式碼(Transformation)

去除顏色與打光

*若無法編譯,點選Setting - Compiler,取消選取C++11



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)
}

STEP 3: 利用mouse()與keyboard()旋轉圖形


STEP 4: 






沒有留言:

張貼留言