2015年3月25日 星期三

Week 05 葉正聖老師示範

電腦圖學 2015-03-25
Computer Graphics Week 05

1. 目標: 自己完成3D模形
2. mouse 可以讓自己的模型轉動(rotate)


1. 想要以上週提過在 張碧娟小姐的 blog, 裡面畫出來的 3D飛機很有趣
https://www.linkedin.com/pulse/debugging-way-learning-pi-chuan-chang

1.1. 先畫出一個小的紅色方塊



1.2. 常見錯誤












期中考考題 (OpenGL 必背10函式, 大小寫及參數要正確, 要有中文註解) 及答案

glPushMatrix(); //備份Matrix

glTranslatef(x, y, z); //移動
glRotatef(angle, x,y,z); //轉動/旋轉
glScalef(x,y,z); //放大縮小

glBegin(GL_POLYGON); //開始畫 polygon多邊形
  glTexCoord2f(tx, ty); //貼圖座標
  glNormal3f(nx, ny, nz); //法向量
  glColor3f(r, g, b);//顏色、色彩
  glVertex3f(x,y,z); //頂點
glEnd();

glPopMatrix(); //還原 Matrix

沒有留言:

張貼留言