0. week10-0_sample
0-1. 安裝freeglut
0-2. 安裝OpenCV2.1
0-3. 重新CodeBlocks, 設定opencv的3個設定
0-4. File ⮕ New ⮕ Project,GLUT專案 week10-0_sample
1. week10-1_TRT_glutSolidCube_myBody_myArm
1-1. File ⮕ New ⮕ Project,GLUT專案 week10-1_TRT_glutSolidCube_myBody_myArm
1-2. 貼上 week09-2 的程式碼 貼上 week09-2 的程式碼
1-3. 修改程式碼
```cpp
void myBody(){
glColor3f(1, 0, 0);
glutSolidCude(0.3);
}
void myArm(){
glColor3f(0, 1, 0);
glScalef(1.5, 0.5, 0.5);
glutSolidCude(0.3);
}
```
2. week10-2_TRT_glutIdleFunc_rotate
2-1. File ⮕ New ⮕ Project,GLUT專案 week10-2_TRT_glutIdleFunc_rotate
2-2. 貼上剛剛的程式碼
2-3. 增加程式碼
```cpp
float angle = 0
void display
{
glRotatef(angle++, 0, 0, 1);
}
int main(int argc, char * argv[])
{
glutIdleFunc(display);
}
```
3. week10-3_TRT_glRotate_glTranslatef
3-1. File ⮕ New ⮕ Project,GLUT專案 week10-3_TRT_glRotate_glTranslatef
3-2. 貼上剛剛的程式碼
3-3. 修改程式碼
```cpp
void display()
{
glTranslatef(0.225, 0, 0);
}
```
4. week10-4_TRT_glTranslatef_glRotate_glTranslatef
4-1. File ⮕ New ⮕ Project,GLUT專案 week10-4_TRT_glTranslatef_glRotate_glTranslatef
4-2. 貼上剛剛的程式碼
4-3. 修改程式碼
5. 剛剛的都再做一次
5-1. 打開 CodeBlocks,對檔案名稱按右鍵,選 Activate project
5-2. 把 week10-1 和 week10-2 的圖案從實心變空心,並移動位置
6. week10-5_two_layers
6-1. File ⮕ New ⮕ Project,GLUT專案 week10-5_two_layers
6-2. 貼上 week10-4 的程式碼
6-3. 修改程式碼
7. week10-6_TRT_left_right
7-1. File ⮕ New ⮕ Project,GLUT專案 week10-6_TRT_left_right
7-2. 貼上 week10-5 的程式碼
7-3. 複製剛剛右手邊的程式碼並修改,變成左手邊
8. week10-7_TRT_mouse_motion_angle
8-1. File ⮕ New ⮕ Project,GLUT專案 week10-7_TRT_mouse_motion_angle
8-2. 貼上 week10-6 的程式碼
8-3. 修改、增加程式碼
```cpp
int main(int argc, char * argv[])
{
glutMotionFunc(motion);
}
void motion(int x, int y)
{
angle = x;
glutPostRedisplay(); ///重畫畫面
}
```
沒有留言:
張貼留言