2023年3月30日 星期四

pei week07

Week07

先到https://jsyeh.org/3dcg10/下載window&data打開texture檔




























這是旋轉方向















進入這個網址https://jsyeh.org/gl/opengl_10_func.html練習地10週的期中考

glPushMatrix();//備份矩陣
    glTranslatef(x,y,z);//移動
    glRotatef(angle,x,y,z);//轉動
    glScalef(x,y,z);//縮放
    glBegin(GL_POLYGON);//開始畫
        glColor3f(r,g,b);//色彩
        glTexCoord2f(tx,ty);//貼圖座標
        glNormal3f(nx,ny,nz);//打光的法向量
        glVertex2f(x,y);//頂點
    glEnd();//結束畫
glPopMatrix();//還原矩陣


week07
下載openCV




















打開codeblocks的setting


















到search directiries
compiler add C:\OpenCV.1\include

















linker add C:\OpenCV.1\lib

















到linker settings
分別 add cv210  cxcore210  higjtgui210


















開一個空的資料夾檔名一定要.cpp
#include <opencv/highgui.h>

int main()
{
    IplImage * img = cvLoadImage("image.jpg");
    cvShowImage("week07", img);
    cvWaitKey(0);
}
打入這個程式
上網找一張照片放到桌布



week07-1

到https://gist.github.com/jsyeh/5ed01210559721ec71b659b3ffed2dd7下載程式碼

















上網找一張地球取名earth存到freeglut裡的bin資料夾

















增加這行程式碼
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();




week07-2-2
















複製老師的程式碼
改圖片名字,跑出會轉的地球
































沒有留言:

張貼留言