1. week09-0_sample
(1)安裝freeglut
(2)開啟新專案:week09-0_sample
(3)安裝 OpenCV --> 詳細去看魚鱗電腦圖學Week05-1
(4)重啟CodeBlocks --> 進入CodeBlocks --> Settings --> Compiler
(4-1)Compiler 的 include 目錄
(4-2)Linker 的 lib 目錄
(4-3)加入 linker 的3個檔名 cv210、cxcore210、highgui210
(5)把上週的GitHub倉庫複製下來
(5-1)安裝Git,開啟Git Bash小黑
(5-2)把上禮拜的東西複製下來
(6)去CodeBlocks把 week08-3_glm_gundam_opencv_texture_lighting 的 cbp檔打開,要出現glm.cpp和main.cpp才是有正確打開
(7)執行看看
2. 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,cbp檔也要改
(3)open file,然後去properties中的title把名字改成week09-1_glm_gundam_opencv_texture_lighting
(4)去Notepad++開啟week09-1_glm_gundam_opencv_texture_lighting,把裡面的 week08-3 都改成 week09-1
(5)去CodeBlocks中開啟檔案
3. week09-2_glutSoildTeapot_glutSoildCube_glutSoildSphere
(1)開啟新專案:week09-2_glutSoildTeapot_glutSoildCube_glutSoildSphere
(2)貼上GLUT 11行程式
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();
}
(3)換畫另外2個
方塊:
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
///glutSolidTeapot(0.3);
glutSolidCube(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();
}
圓形:
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
///glutSolidTeapot(0.3);
///glutSolidCube(0.3);
glutSolidSphere(0.3,30,30);
glutSwapBuffers();
}
int main(int argc, char*argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week09 Microsoft Visual Studio");
glutDisplayFunc(display);
glutMainLoop();
}
(4)把三個圖形畫在一起
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
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();
}
int main(int argc, char*argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week09 Microsoft Visual Studio");
glutDisplayFunc(display);
glutMainLoop();
}
4. week09-3_glutWireTeapot_glutWireCube_glutWireSphere
(1)開啟新專案:week09-3_glutWireTeapot_glutWireCube_glutWireSphere
(2)貼上 week09-2_glutSoildTeapot_glutSoildCube_glutSoildSphere 的程式
(3)把三段再複製到下面,並把下面那段的y座標改成負的
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
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();
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();
}
int main(int argc, char*argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week09 Microsoft Visual Studio");
glutDisplayFunc(display);
glutMainLoop();
}
5. 上傳到GitHub







沒有留言:
張貼留言