2022年5月10日 星期二

shhhhi : )

 week12

1. 至jsyeh.org/3dcg10 下載 data.zip , windows.zip 

2.打開 window/Transformation.exe

(1)

glTranslatef( 0.9 , 0 , 0 );

glRotatef( angle , 0 , 1 , 0 );

👉在右邊 轉動的 藍色車子



(2)按右鍵交換程式碼 Swap translate/rotate

glRotatef( angle , 0 , 1 , 0 );

glTranslatef( 0.9 , 0 , 0 );

👉繞著中間轉彎的車子


2.對特定軸轉動練習

(1) 120.125.80.50/GL(練習網站)

(2) ctrl-R清空

(3)畫身體 myDrawObject(0)

     畫手臂 myDrawObject(1)

(4)可更改程式碼順序

(5)按 angle= 再按空白建 會自動變成動畫

結果:

3.讓手臂的軸心移至中心轉動

glPushMatric();

    myDrawObject(0);///身體

    glRotatef( angle , 0 , 0 , 1 );///轉動,影響下方程式

    myDrawObject(1);///手臂

    glTranslatef( -0.3 , -0.9 , 0);///往左下方移至中心

glPopMatric();

結果:

4.將手臂掛到身體右上角

glPushMatric();

    myDrawObject(0);///身體

    glTranslatef( 0.29 , 0.31 , 0 );///掛到身體右上角

    glRotatef( angle , 0 , 0 , 1 );///轉動,影響下方程式

    myDrawObject(1);手臂

    glTranslatef( -0.3 , -0.9 , 0);///往左下方移至中心

glPopMatric();

結果:

5.期中考題

6. week12-TRT (用茶壺實現第3第4點)

程式碼:


7. week12-TRT-TRT

程式碼:


重點:







沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

一.     一樣先安裝且設定好freeglut,OpecCV, 開啟CodeBlocks建立新專案 week11_gundam,                 把 MyGundam.zip下載解壓縮後的data資料夾放到freeglut/bin裡面 把week09_openc...