2019年4月11日 星期四

金魚腦波學

電腦圖學

1.主題:貼圖Texture2.範例:Texture.exe3.實作:OpenCV4.實作:OpenCV+OpenGL貼圖5.期中考:10行OpenGL程式
http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/下載win32 data glut32.dll

範例:Texture.exe


*Texture貼圖
安培右手定則:
大拇指指向前,逆時針旋轉
座標順序(0,0) (1,0) (1,1) (0,1)

圖檔出現
1.https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.1/
載2008那個
2.小畫家畫地球存在freeglut的bin
3.開啟codeblocks的glut檔
4.左邊Week08按右鍵(Build options)
5.找到目錄(director)add include
6.找到(linker) add lib cv210 cxcore210 highgut210

#include <GL/glut.h>
#include <opencv/highgui.h>貼圖需要
void display()
{
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glutSolidTeapot(0.3);
    glutSwapBuffers();
}
int main(int argc,char**argv)
{
    IplImage*img=cvLoadImage("earth.png");貼圖需要
    cvShowImage("opencv Window",img);
    cvWaitKey(0);
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
    glutCreateWindow("week08");
    glutDisplayFunc(display);

    glutMainLoop();
}







沒有留言:

張貼留言