1.從上課軟體下載freeglut
2.將壓縮檔解壓到桌面
3.點開freeglut後復製其連結
4.點開lib後將freeglut.a復製
5.改名為libglut32.a (124KB)
6.到codeblock開新的專案 file > project,(檔名為week16-0)
7.opencv安裝
8.選項選2或3
9.不要更換目標資料夾
10.重開codeblocks
11.設定Settings-compiler要加入三個設定
11.1.search 目錄 compiler 的include 目錄 加 C:\OpenCV2.1\include
14.week16-1_sample_gluLookAt
在39行新增gluLookAt(0,0,0, -2.4,1.2,-6, 0,1,0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,0,0,1.2,-6,0,1,0);
}else if(key=='2'){
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,0, 0,1.2,-6, 0,1,0);
}else if(key=='3'){
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,0, +2.4,1.2,-6, 0,1,0);
}
1
2.3.
16.
week16-2
用之前的11行改
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
void reshape(int w, int h){
glViewport(0,0,w,h);
float ar = w/(float) h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60,ar,0.01,100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,-2,0,0,0,0,1,0);}
int main(int argc,char*argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("week16-2");
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutMainLoop();
}
.png)
.png)
.png)
.png)
.png)
.png)
.png)
.png)
沒有留言:
張貼留言