2019年4月11日 星期四

06160150_蔡宗芸 W8

電腦圖學 2019-04-11  Week08

(1).主題 : 貼圖 Texture

(2).實作 : Texture.exe

(3).實作 : openCV

(4).實作 : openCV + openGL貼圖

(5).期中考 : 10行openGL程式



(一)開啟Texture.exe

先到http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/下載3個並且解壓縮




把data和glut32.dll丟到windows裡面





開啟Texture.exe



(二)

先到https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.1/下載



下載後點開

(三)




#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("star.jpg"); ///貼圖需要
    cvShowImage("opencv Window", img); ///貼圖需要
    cvWaitKey(0); ///貼圖需要

    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
    glutCreateWindow("06160150-W8");
    glutDisplayFunc(display);
    glutMainLoop();
}


















沒有留言:

張貼留言