week10
1.下載OpenCV
2.1.OpenCV設定: Setting Compiler / Search Directories / Compiler / include: C:\OpenCV2.1\include
2.2.OpenCV設定: Setting Complier / Search Directories / Linker lib 目錄:
C:\OpenCV2.1\lib
2.3.OpenCV設定: Setting Complier / Linker設定 cv210 , cxcore210 ,highgui210
2.4 earth.jpg圖檔放哪裡,codeblocks工作目錄 working dir ( freeglut/bin )
3.利用 glBegin(GLUT_POLYGON) , glEnd() ,中間夾4次(4個角) glTexcoord2f()
4. week10-textrue-background貼圖背景
程式碼:
5.week10-texture-earth上週貼圖+貼到圓球=地球
👉 GLUquadric * sphere=NULL;///指標指到二次曲面
main中:
gluQuadricTexture(sphere,1);///設好貼圖
gluSphere(sphere,1,30,30);///畫圓球
display中:
sphere=gluNewQuadric();///準備好二次曲面
結果:
程式碼:
6.week10-texture-earth-rotate讓地球旋轉
👉float angle=0;///旋轉角度
display中:
glRotatef(angle,0,1,0);///把它轉正
angle+=0.05;///每執行1次,加1度
main中:
glEnable(GL_DEPTH_TEST);///開3D深度
glutIdleFunc(display);///有空idle呼叫display
結果:
程式碼:
.png)
.png)
.png)

沒有留言:
張貼留言