顯示具有 Week03 標籤的文章。 顯示所有文章
顯示具有 Week03 標籤的文章。 顯示所有文章

2015年3月16日 星期一

02160660_楊涵雯_Week03

1.點.線.面.顏色
先到jsyeh.org/3dcg10下載win32  data  glut32.dll
解壓縮win32   把data  glut32.dll拉到win32的資料夾
開啟Shapes.exe   可以跑點.線.面.顏色的圖形

2.5行程式碼
下載freeglut 2.8.1-1 forMinGW
改名libglut32.a
複製C:\Users\USER\Downloads\freeglut-MinGW-2.8.1-1.mp\freeglut路徑
做出黃色的茶壺、彩色茶壺
改背景顏色
用點  做出多邊形  並改顏色



3.glut範例
4.電腦學之父

2015年3月12日 星期四

FreeGLUT Test3

1.試用台大OpenGL程式
2.學習更改顏色 (glColor3f(r,g,b)  4為r,g,b,a   a-表透明度)
3.更改背景顏色
4.嘗試用點線面繪圖
5.自主嘗試

#include <GL/glut.h>

void display();
int main(int argc,char **argv)
{
    glutInit(&argc,argv);
    glutCreateWindow("02160295");
    glutDisplayFunc(display);
    glutMainLoop();
}
void display()
{
    glClearColor(0, 0.5, 0.5, 1);    //選擇被景色
    glClear(GL_COLOR_BUFFER_BIT);   //刷上被景色
    glBegin(GL_POLYGON);   //開始創造多邊形
      glColor3f(1,0,0);  //選擇顏色

      glVertex2f(0,0);
      glVertex2f(-0.5,0.5);
      glVertex2f(-1,0.5);
      glVertex2f(-1,-0.3);
      glVertex2f(0,-1);
      glVertex2f(1,-0.3);
      glVertex2f(1,0.5);
      glVertex2f(0.5,0.5);
     // glVertex2f(0,1);
    glEnd();  //結束

    glFlush();
}





week3_hw1 蔡瑩盈

1. 打網址 jsyeh.org/3dcg10
下載data,win32,glut32.dull
2. 把windows.zip解壓縮
把glut32.dll檔、data.zip壓縮好然後丟入windows資料夾

 3. try try範例 shape

 4.搜尋freeglut然後在code block做上禮拜的動作


 5.測試茶壺變顏色的程式碼
#include <GL/glut.h>///呼叫外掛#include GL/glut的功能
void display()
{
    glColor3f(1,0,1);   // 三顏色  浮點數
    glutSolidTeapot(0.5);

    glFlush();
}
int main(int argc, char **argv)
{
    glutInit(&argc,argv);///3.把glut準備好,參數照舊
    glutCreateWindow("資傳拉拉得冠軍");///建置視窗(小駱駝命名法)
    glutDisplayFunc(display);
    glutMainLoop();///glut的主要迴圈,卡住用的

}


6.測試顏色重疊效果
#include <GL/glut.h>///呼叫外掛#include GL/glut的功能
void display()
{
    glColor3f(1,0,0);
    glutSolidTeapot(0.5);

    glColor3f(0,1,0);
    glutSolidTeapot(0.4);

    glColor3f(0,0,1);
    glutSolidTeapot(0.3);

    glFlush();
}
int main(int argc, char **argv)
{
    glutInit(&argc,argv);///3.把glut準備好,參數照舊
    glutCreateWindow("資傳拉拉得冠軍");///建置視窗(小駱駝命名法)
    glutDisplayFunc(display);
    glutMainLoop();///glut的主要迴圈,卡住用的

}

7.測試
glClearColor(0,0.2,1.6,1); //用來Clear清的顏色是捨麼
    glClear(GL_COLOR_BUFFER_BIT);//Clear  buffer


 8.測試畫圖形
#include <GL/glut.h>
void display()
{
    glClearColor(0.2,0,9,3);                            ///重點3.用來Clear清的顏色是什麼
    glClear(GL_COLOR_BUFFER_BIT);    ///重點2.Clear說明你清哪一個Buffer

    glBegin(GL_POLYGON);
        glColor3f(4,6,0);                                  ///今天的重點1.有顏色的茶壺
        glVertex2f(0,0);
        glVertex2f(1,0);
        glVertex2f(0,1);
    glEnd();
    glBegin(GL_POLYGON);
        glColor3f(1,1,5);
        glVertex2f(0,0);

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

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

    glEnd();
    glFlush();
}

int main(int argc,char**argv)
{
    glutInit(&argc,argv);
    glutCreateWindow("資傳拉拉得冠軍");
    glutDisplayFunc(display);
    glutMainLoop();
}


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();




02160350喻婉晴_week03










Week03

1. jsyeh.org/3dcg10 下載
data 、win32、 glut32.dll這三個檔案

將windows解壓縮 然後將其他兩個檔案丟進去,在執行執行shapes.exe



#include <GL/glut.h>

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

    glFlush();
}
int main (int arge, char **argv)
{
    glutInit(&arge,argv);
    glutCreateWindow("01160536");

    glutDisplayFunc(display);
    glutMainLoop();
}



week03

第一步:開啟glut將上週的茶壺程式碼加了3行程式碼之後,調整數值改變茶壺顏色
第二步:然後增加三個茶壺和換背景顏色
第三步:畫多邊形
glBegin(GL_POLYGON); //開始畫
glColor3f() //可設置個點的顏色
glVertex2f()//各點的座標
glEnd() //結束畫


week3




 先劃出一個茶壺
 使用Clear把背景清除(要先清除再畫茶壺)
使用點和線畫出三角形
用座標畫出大小
用兩個一樣的程式碼但是不同座標化出不一樣的三角形並上色

week03_李慎行

今日課程

(1) 點 . 線 . 面 . 顏色
(2)5行程式
(3)glut範例
(4)電腦圖學之父

在 jsyeh/3dcg10/ 裡 Download 1. data 2. win32 3. glut.dll

freeglut Windows Development Libraries - Transmission Zero
去下載freeglut 2.8.1 MinGW Package的Download freeglut 

下載完解壓縮 並把名稱為libfreeglut.a的檔案複製
並貼上且修改名稱為libglut32.a
接著在上周的茶壺程式碼裏頭加上一行
glColor3f(1,1,0); 可使茶壺變色
進階版
glClearColor(0.7 , 0 , 0.6 , 1);///今天重點3: 用來Clear輕的顏色是甚麼
    glClear(GL_COLOR_BUFFER_BIT);///今天重點2: Clear而且要說明你清哪一個buffer
    glColor3f(1,1,0);///今天重點1: Color
    glutSolidTeapot(0.5);///!!!上週7: 畫實心的茶壺
    glColor3f(0,1,0);
    glutSolidTeapot(0.4);///!!!上週7: 畫實心的茶壺
    glColor3f(0,0,1);
    glutSolidTeapot(0.3);///!!!上週7: 畫實心的茶壺
    glFlush();///!!!上週8: 把畫好的東西整個Flush沖出來