#week09-0_sample
1. 安裝freeglut --> File -->New --> Project --> GLUT專案 week09-0_sample
#複習上週的week08-3_glm_gundam_opencv_texture_lighting
要把環境設定好: Open CV
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 倉庫複製下來
安裝Git,開啟 Git Bash小黑 (要選Launch Git Bash)
指令: (1) cd desktop
(2) git clone https://github.com/ccytong/2024graphicsa
(3) cd 2024graphicsa
(4) start .
把上週的week08-3_glm_gundam_opencv_texture_lighting開起來
1. File --> Open 到week08-3的目錄,點開.cbp檔 (CodeBlocks Project檔)
2. Build&Run 就可以
! 把剛剛的專案變成week09-1_glm_gundam_opencv_texture_lighting
1. 把剛剛的專案先關起來,按右鍵Close Project (這樣才不會被鎖)
2. 把整個week08-3_glm_gundam_opencv_texture_lighting檔案複製到桌面,改名為week09-1_glm_gundam_opencv_texture_lighting
3. 把檔案裡面的week08-1_glm_gundam_opencv_texture_lighting.cbp改名為week09-1_glm_gundam_opencv_texture_lighting.cbp
4. 把week09-1_glm_gundam_opencv_texture_lighting.cbp按右鍵,用Notepad++開啟,全部的week08-3要全改成week09-1 (要記得存檔 !)
5. 再用 CodeBlocks File-Open 開啟就好了 !
為了改得更徹底,main.cpp裡的 glutCreateWindow("week08 Gundam") 改成 ("week09-1")
1. 貼上11行glut程式碼
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc, char*argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week09 Microsoft Visual Studio");
glutDisplayFunc(display);
glutMainLoop();
}
2. 畫3個圖案(黃框)
#week09-3_glutWireTeapot_glutWireCube_glutWireSphere (空心)
1. 貼上上一個的程式碼
2. 把實心的圖案改成空心的 (Solid --> Wire)
沒有留言:
張貼留言