到https://jsyeh.org/3dcg10/ 下載解壓縮 data win 打開Texture.exe
調整顏色:
https://jsyeh.org/gl/opengl_10_func.html
opengl 10行程式碼
先Search在Linker:Search:compiler,linker
程式碼:
#include <opencv/highgui.h>
int main()
{
IplImage*img=cvLoadImage("a.jpg");///檔名
cvShowImage("week07",img);
cvWaitKey(0);
}
圖片存桌面,檔案也是
注意要存成.cpp檔,不是.c檔
顯示圖片:
到:https://gist.github.com/jsyeh/找到程式碼:mytexture_sample.cpp
複製貼上codeblocks opengl新專案
增加程式碼在21跟28行之間:glBegin(GL_POLYGON);
glTexCoord2f(0,0);glVertex2f(-1,1);
glTexCoord2f(1,0);glVertex2f(1,1);
glTexCoord2f(1,1);glVertex2f(1,-1);
glTexCoord2f(0,1);glVertex2f(-1,-1);
glEnd();
再開一個新專案
再到:https://gist.github.com/jsyeh/
找到程式碼:
myEarth.cpp 複製貼上
把week10改成week07和earth.jpg。










沒有留言:
張貼留言