電腦圖學 Week8
(1)主題:貼圖Texture
(2)範例:Texture.exe
(3)實作:OpenCV
(4)實作:OpenCV+OpenGL貼圖
(5)期中考:10行OpenGL程式
(1)
下載data、windows、glut32.dll
http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/?fbclid=IwAR1WmtsndmFz2bhoLpn8DHFbgaWB4M4L-ivxFBbAbevee9dNWaRS0GiOt8M
(2)
將glut32.dll、data放入windows
(3)
開啟texture
(4)
下載opencv2.1
https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.1/
(5)
https://www.transmissionzero.co.uk/software/freeglut-devel/
(6)
打開opengl後,放入茶壺的程式
(7)將圖片放進freeglut裡的bin
(8)
打開build options
(9)
將opencv裡lib的內容
(10)
打入程式:
#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("a.jpg");
cvShowImage("opencv Window", img);
cvWaitKey(0);
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("Week08");
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言