-打開 Texture.exe
-下載OpenCV
-重新打開 CodeBlocks
#include <opencv/highgui.h>
int main()
{
///Ipl是 Intel performance library 的縮寫
IplImage * img = cvLoadImage("檔名.png");///讀圖
cvShowImage("week09",img);///秀圖
cvWaitKey(0);///等任意鍵繼續
}
#include <GL/glut.h>
#include <opencv/highgui.h>
void myTexture()
{
IplImage *img = cvLoadImage("earth.jpg");///找earth的圖片
cvShowImage("img",img);///在img視窗放圖片
cvWaitKey(0);///等任意鍵繼續
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("week09 texture");
glutDisplayFunc(display);
myTexture();
glutMainLoop();
}
沒有留言:
張貼留言