0. week11-0_sample
0-1. 安裝freeglut
0-2. 安裝OpenCV2.1
0-3. 重新CodeBlocks, 設定opencv的3個設定
0-4. File ⮕ New ⮕ Project,GLUT專案 week11-0_sample
1. week11-1_TRT_again
1-1. File ⮕ New ⮕ Project,GLUT專案 week11-1_TRT_again
1-2. 複製上週 week10-1 的程式碼
1-3. T-R-T 的程式碼
```cpp
void myArm()
{
glPushMatrix();
glColor3f(0, 1, 0); ///綠色的手臂
glScalef(1.5, 0.5, 0.5); ///寬變1.5,高度變0.5倍
glutWireCube( 0.3 ); ///方塊
glPopMatrix();
}
float angle=0;
void display()
{
glTranslatef(0.3, 0.3, 0);
glRotatef(angle++, 0, 0, 1);
glTranslatef(0.45 / 2, 0, 0);
myArm();
}
int main(int argc, char *argv[])
{
glutIdleFunc(display);
}
```
2. week11-2_obj_gundam_opencv_texture_lighting
2-1. File ⮕ New ⮕ Project,GLUT專案 week11-2_obj_gundam_opencv_texture_lighting
2-2. 將之前 week09-1 的檔案複製,把名字改成 week11-2_obj_gundam_opencv_texture_lighting
2-3. 用 Project-Properties 去改 Title
2-4. 去 Maya 將整隻剛彈變成只有一隻手臂
2-5. 改模型檔名(不然可能會找不到圖)
3. week11-3_obj_gundam_hand1_hand2
3-1. 複製前個專案,並改名為 week11-3_obj_gundam_hand1_hand2
3-2. 裡面的 .cbp 檔名也要記得改
3-3. 複製 hand1、hand2 的 .obj、.mtl 模型檔到 week11-3 的目錄
3-4. 修改程式碼
3-5. T-R-T 程式碼
```cpp
void display()
{
glTranslatef(-0.3, 0.3, 0); ///掛到肩上
glTranslatef(-0.45/2, 0, 0); ///把旋轉中心,放正中心
glTranslatef(0.3, 0.3, 0); ///掛到肩上
glTranslatef(0.45/2, 0, 0); ///把旋轉中心,放正中心
drawhand2();
}
```
.png)
.png)
.png)
.png)
沒有留言:
張貼留言