範例檔:week09-0_sample
1. moodle下載 freeglut 拖到桌面
2. 把桌面\freglut\lib\libfreeglut.a 複製成 libglut32.a
3. CodeBlocks開GLUT專案, 目錄選桌面, 專案名取week09-0_sample
複習檔案
1. 安裝git, 把github上之前寫過的程式複製到桌面
- cd desktop
- git clone https://github.com/xiyu-emma/2024graphicsa
2. 安裝 OpenCV 2.1
- 安裝第三步驟, Add OpenCV to system PATH(勾第2或3個, 不要勾第1個)
- 目錄不要改,要用預設的
- 要重開CodeBlocks
3. CodeBlocks 的 settings>compiler 加入 opencv 的3個設定
- Search directories > Compiler 要加上 C:\OpenCV2.1\include
- Search directories > Linker 要加上 C:\OpenCV2.1\lib
- Linker settings 要加上 cv210 / cxcore210 / highgui210
4. 開啟上週的檔案week08-3_glm_gundam_opencv_texture_lighting(.cbp檔)
鋼彈貼圖:week09-1_glm_gundam_opencv_texture
1. 關掉week08-3, 右鍵close project
2. 把整個week08-3複製貼上到桌面, 檔名改成week09-1
3. cbp檔右鍵用notepad++開啟, 把所有week08-3都改成week09-1
4. CodeBlocks開啟week09-1, 把視窗名稱改成glutCreateWindow("week09 Gundam");
1. CodeBlocks開GLUT專案, 目錄選桌面, 專案名取
week09-2_glutSolidTeapot_glutSolidCube_glutSolidSphere
3. 貼上glut 11行程式碼
4. 把glutSolidTeapot(0.3);改成glutSolidCube(0.3); 就會變成方塊
5. 把glutSolidTeapot(0.3);改成glutSolidSphere(0.3, 30, 30); 就會變成圓形
三個空心形狀:
week09-3_glutWireTeapot_glutWireCube_glutWireSphere
1. CodeBlocks開GLUT專案, 目錄選桌面, 專案名取
week09-3_glutWireTeapot_glutWireCube_glutWireSphere
3. 貼上glut 11行程式碼
4. 把形狀的部分再複製一次, Solid都改成Wired, 座標改成負的
glPushMatrix();
glTranslatef(-0.5, -0.3, 0);
glutWireTeapot(0.3);
glPopMatrix();
glPushMatrix();
glTranslatef(+0.0, -0.3, 0);
glutWireCube(0.3);
glPopMatrix();
glPushMatrix();
glTranslatef(+0.5, -0.3, 0);
glutWireSphere(0.3, 30, 30);
glPopMatrix();
glutSwapBuffers();
沒有留言:
張貼留言