2019年5月2日 星期四

ˊ_>ˋ_week08_貼圖 Texture

主題: 貼圖 Texture

(1) 範例: Texture.exe



(2) 實作: OpenCV

step1:下載OpenCV





完成安裝後-->開新的Glut project

(3) 實作: OpenCV + OpenGL 貼圖


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

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

    glutDisplayFunc(display);

    glutMainLoop();
}


(4) 期中考: 10行 OpenGL 程式

沒有留言:

張貼留言