2018年3月30日 星期五

week05-洪梓菱


(1)到jsyeh.org/3dcg10  下載data.zip,windows.zip,glut32.dil,並解壓縮,開啟Transformation.exe。



(2)glTranslatef ()移動
glRotatef()轉動
glScalef()放大一台車子
glBegin()車子



(1)下載freefult並執行開啟


(2)glRotated(a,0,0,1);
        glTranslated(-2.4,1.2,-6);
更改這2行程式讓球可以轉動


(3)glColor3f(1,1,1);//把其他物體變白色

讓茶壺移動

(1)glTranslatef(0.45,-0.10,0);//讓茶壺柄在中間,等等以茶柄為中心轉動

(2)glRotatef(angle, 0,0,1);///Now:轉動,讓底下的程式給茶壺轉動



(3)glColor3f(1,0,0);  glutSolidTeapot(0.3)//把茶壺變色


(4)懸掛兩個茶壺

    glPushMatrix();///Now:備份矩陣
        glColor3f(1,0,0);  glutSolidTeapot(0.3);//紅色茶壺
        glPushMatrix();
            glTranslatef(0.4,0.13,0);//最後掛上去
            glRotatef(angle, 0,0,1);///Now:轉動,讓底下的程式給茶壺轉動
            glTranslatef(0.45,-0.10,0);//Now2:把茶壺柄放到中間
            glColor3f(0,1,0);  glutSolidTeapot(0.3);//綠色茶壺
            glPushMatrix();
                glTranslatef(0.4,0.13,0);//最後掛上去
                glRotatef(angle, 0,0,1);///Now:轉動,讓底下的程式給茶壺轉動
                glTranslatef(0.45,-0.10,0);//Now2:把茶壺柄放到中間
                glColor3f(0,1,0);  glutSolidTeapot(0.3);//綠色茶壺
    glPopMatrix();///Now:還原矩陣
    glPopMatrix();
    glPopMatrix();
    glutSwapBuffers();


(5)複製右手臂程式,並更改座標,使茶壺有兩隻手臂




沒有留言:

張貼留言