2019年4月11日 星期四

week08貼圖

主題:貼圖Texture
1.把[data][window62]glut32.dll下載
2.把dataˋwindow32解壓縮
3.把data跟glut32.dll丟進window32裡面
4.開啟Texture
實作:OpenCV+OpenGL貼圖
google:OpenCV2.1找到第一個
裡面OpenCV-2.1.1-win32-vs2008.exe安裝
(1)要C:\OpenCV2.1目錄
(2)要選 Add PATH
(3)裝好才能啟動codeblocks
下載https://www.transmissionzero.co.uk/software/freeglut-devel/
從CODEbLOCKS開啟glut專案把freeglut拉到桌面libfreeglut.a改成libglut32.a
然後按照圖片的步驟





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

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

    glutDisplayFunc(display);

    glutMainLoop();
}




沒有留言:

張貼留言