2024年4月18日 星期四

C~電腦圖學日誌 Week09

Week09主題:glut函式

week09-0_sample

1.安裝freeglut,複製libfreeglut.a改成libglut32.a

2.新增專案取名成week09-0_sample


week09-1_glm_gundam_opencv_textrue_lighting

複習上周的week08-3_glm_gundam_opencv_textrue_lighting

並做用Notepad++開啟來修改

下載OpenCV

1 選第2或3選項別選第1個

2 安裝在預設的目錄

3 重開CodeBlocks(讓編譯器讀到檔案)

4.0 去設定 Settings->Compiler 要加3個設定

4.1 search目錄 Compiler的 include目錄  加C:\OpenCV2.1\include

4.2 search目錄 Linker 的 lib目錄  加C:\OpenCV2.1\lib

4.3 加入Linker設定的 3個檔名 cv210 cxcore210 highgui210

5.0 下載Git並輸入指令

5.1  cd desktop

5.2  git clone https://github.com/sssrrr0987/2024graphicsa

5.3  cd 2024graphicsa

5.4  start .

5.5 把week08_3複製到桌面做修改

6 用Notepad++開啟來修改




7 用Notepad++開啟來修改





8 成功開啟的檔案





week09-2_glutSolidTeapot_glutSolidCube_glutSolidSphere

功能是創建實心的圖案

1.開新專案

2.上11行GLUT的程式

3.試著畫出glut的方塊、圓形

///glutSolidTeapot(0.3);

///glutSolidCube(0.3);方塊

glutSolidSphere(0.3,30,30);圓形



4.加上程式碼 並移動各圖形位置
glPushMatrix();
        glTranslatef(-0.5, +0.3, 0);
        glutSolidTeapot(0.3);
glPopMatrix();

glPushMatrix();
        glTranslatef(-0.0, +0.3, 0);
        glutSolidCube(0.3);
glPopMatrix();

glPushMatrix();
        glTranslatef(+0.5, +0.3, 0);
        glutSolidSphere(0.3, 30, 30);
glPopMatrix();

glutSwapBuffers();



week09-3_glutWireTeapot_glutWireCube_glutWireSphere

功能是創建空心的圖案

1.開新專案取成week09-3_glutWireTeapot_glutWireCube_glutWireSphere

2. 貼上week09-2_glutSolidTeapot_glutSolidCube_glutSolidSphere程式

3.修改程式碼把Solid改成Wire,並把glTranslatef的Y座標改成負

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();



上傳Github




沒有留言:

張貼留言