2024年5月2日 星期四

YT's 電腦圖學 Week11

#week11-0_sample 

0. 安裝freeglut


 #week11-1_TRT_again 

1. 把上周 week10-1_glutWireCube_myBody_myArm 拿來用

2. 用剛剛交的 "小考TRT程式碼" 來做修改

glPushMatrix();

        glTranslatef();  Step3:移位

        glRotatef();  Step2:旋轉角度

        glTranslatef();  Step1: 把旋轉中心放到正中心

glPopMatrix();







 #week11-2_obj_gundam_opencv_texture_lighting 

用 GitHub 下載下來,複製整個目錄、改檔名、改 Title

1. 安裝 OpenCV 2.1 (桌面上的葉正聖上課用軟體 OpenCV-2.1.0)

!注意! (1) 要選第二個 Add Path

         (2) 目錄不要改

          (3) 要重開 CodeBlocks

CodeBlocks --> Setting -->Compiler裡,要設定3個地方:
  • Search directories 的 compiler 要加入 C:\OpenCV2.1\include
  • Linker 的 lib 要加入 C:\OpenCV2.1\lib
  • Linker 設定,要加入 cv210 、 cxcore210 、 highgui210

2. 接下來把 GitHub 的程式倉庫下載下來

week09-1_glm_opencv_texture_lighting 拿來用,複製成 

week11-2_glm_opencv_texture_lighting

安裝Git,開啟 Git Bash小黑 (要選Launch Git Bash)

指令: (1) cd desktop
        (2) git clone https://github.com/ccytong/2024graphicsa
        (3) cd 2024graphicsa
        (4) start .


另一種下載法 : 到 GitHub 2024graphicsa 首頁,有一個綠色的 Code 鍵,按

DownLoad ZIP 就會下載整個程式擋


!! 把 week09-1_glm_opencv_texture_lighting 檔案拉到桌面再改檔名 !!

3. 在 GitHub Open cbp 檔,再按 Propertries 改檔名為 week11-2...

按執行就會出現鋼彈 






 # Maya切割、匯出 OBJ 

1. import gundam.obj 到 maya

2. 留下左臂和右臂,分別存檔

File --> Export All --> 存為 obj 檔 !



3.  把下列4個檔案 複製貼上到 week11-2... 裡的 data檔

-- handa.obj + handa.mtl
-- handb.obj + handb.mtl

4.  改程式碼 GLModel * pmodel = NULL; 改成

GLMmodel * pmodel = NULL;

GLMmodel * handa = NULL;

GLMmodel * handb = NULL;


! drawhanda(); 後就會畫出左手






















沒有留言:

張貼留言