2016年3月22日 星期二

Week 05 王薏婷

Homework 1

  • 判斷 Translatef 與 Rotatef 轉動的差別
    • Translatef 是更改中心軸的位子
    • Rotatef 是以物件為轉動的中心點




  • Q1 :  當中心軸的位置未改變為(0,0,0),則看起來像是車子繞自己轉動
  • Q2:   當改變中心軸位子,則為看起來為車子繞著改變的中心軸轉動
Homework 2

#include <GL/glut.h>
float rotX;
void display()
{
    glClearColor(0.5,0,0,0.5);
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
        glRotatef(rotX,0,1,0);  
        glColor3f(1,1,0);
        glutSolidTeapot (0.3);  
    glPopMatrix();
    glutSwapBuffers();

}
void motion (int x,int y)
{
    rotX= x;
    display();
}
int main(int argc,char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Picture rotate");

    glutDisplayFunc(display);
    glutMotionFunc(motion);
    ///glutMouseFun(mouse);
    glutMainLoop();
}


  • Q 1  . Buffer : 緩衝記憶體
    •  glutSwapBuffers : 顯示緩衝記憶體的畫面
  • Q 2 . GLUT_DOUBLE : 兩倍的緩衝記憶體
Homework 3

  • glRotatef (rotY,1,0,0);  /// 旋轉:  以X軸為選轉軸轉動,以rotx為選轉角度
  • glRotatef (rotX,0,1,0);  /// 旋轉:  以Y軸為選轉軸轉動,以roty為選轉角度
  • Push and Pop
    • Push :將資料放入記憶體中
    • Pop : 將資料從記憶體中彈出
  • What is the Matrix in this code?
    • glRotatef () , glColor3f () , glSolidTeapot () 


沒有留言:

張貼留言