2019年4月11日 星期四

KOKOTING_week08

Week 08


(1)主題:貼圖Texture
(2)範例:Texture
(3)實作:OpenCV
(4)OpenCV+Open GL貼圖
(5)期中考:十行OpenGL程式


(一)
到老師的網站下載data、win32、glut32.dll

解壓縮windows,把data、glut32.dll丟進windows

就可以打開texture試試看囉


(二)
開啟glut project
輸入程式碼
#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("exo.png");///貼圖需要
    cvShowImage("opencv Window", img);///貼圖需要
    cvWaitKey(0);///貼圖需要

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE |GLUT_DEPTH);
    glutCreateWindow("Week08");

    glutDisplayFunc(display);

    glutMainLoop();
}

對專案資料夾按右鍵→選Bulid option

輸入路徑C:\OpenCV2.1\include

和輸入cv210、cxcore210和highgui210

!!(記得把圖檔丟到C:\Users\user\Desktop\freeglut\bin)!!
就可以開啟貼圖啦~~~~~

沒有留言:

張貼留言