2015年3月12日 星期四

02160111_鄭庭峰_week3

一.  先下在下方3個東西

放入windows資料夾

複製並改名字

打上周程式 外加 讓茶壺變色的函式


 void display()
 {
     glColor3f(1,0,1);
     glutSolidTeapot(0.4);
     glFlush();
 }


額外教的的重疊

void display()
 {
     glColor3f(1,0,1);
     glutSolidTeapot(0.5);
     glColor3f(1,1,0);
     glutSolidTeapot(0.4);
     glColor3f(0,1,1);
     glutSolidTeapot(0.3);
     glColor3f(1,1,1);
     glutSolidTeapot(0.2);
     glColor3f(0,0,0);
     glutSolidTeapot(0.1);
     glFlush();
 }


改變背景顏色

glClearColor(0.7, 0, 0.6, 1);  
glClear(GL_COLOR_BUFFER_BIT);


 在三角形的三頂點上不同的顏色
glBegin(GL_POLYGON);   ///POLYGON 多邊形
      glColor3f(1, 1, 0);
      glVertex2f(0, 0);
      glVertex2f(1, 0);
      glVertex2f(0, 1);
     glEnd();

     glBegin(GL_POLYGON);
      glColor3f(1, 0, 0);
      glVertex2f(0, 0);    ///3頂點顏色

      glColor3f(0, 1, 0);
      glVertex2f(-1, 0);

      glColor3f(1, 0, 1);
      glVertex2f(0, -1);
    glEnd();




沒有留言:

張貼留言